diff --git a/src/app/search/directive/search_results.js b/src/app/search/directive/search_results.js index b2df3875..318a467f 100644 --- a/src/app/search/directive/search_results.js +++ b/src/app/search/directive/search_results.js @@ -20,7 +20,7 @@ * @see ProjectListController */ angular.module('sb.search').directive('searchResults', - function ($log, $parse, Criteria, $injector, Preference) { + function ($log, $parse, Criteria, $injector, Preference, User) { 'use strict'; return { @@ -36,6 +36,41 @@ angular.module('sb.search').directive('searchResults', args.searchWithoutCriteria === 'true'; var criteria = []; + //Controls dropdown events + $scope.dropdownControl = function(choice){ + if (choice === 'open'){ + angular.element(document.querySelector('#query')) + .addClass('open'); + return; + } + angular.element(document.querySelector('#query')) + .removeClass('open'); + }; + + //Controls which columns are chosen + $scope.columnControl = function(filter){ + if ($scope.chosenCriteria.includes(filter)){ + $scope.chosenCriteria.splice($scope.chosenCriteria + .indexOf(filter), 1); + return; + } + $scope.chosenCriteria.push(filter); + }; + + //Dropdown Options + $scope.queryFilters = { + 'created_at': 'Created At', + 'updated_at': 'Updated At', + 'status': 'Status', + 'private': 'Private', + 'creator_id': 'Creator' + + }; + + + $scope.chosenCriteria = ['created_at', 'updated_at', 'status']; + $scope.timeCriteria = ['created_at', 'updated_at']; + $scope.isSearching = false; $scope.searchResults = []; @@ -53,6 +88,16 @@ angular.module('sb.search').directive('searchResults', */ $scope.sortDirection = 'desc'; + function showFullName(story_object){ + var full_name; + story_object.forEach(function(story){ + full_name = User.get({'id': story.creator_id}); + full_name.$promise.then(function(data){ + story.creator_id = data.full_name; + }); + }); + } + /** * Handle error result. */ @@ -71,6 +116,7 @@ angular.module('sb.search').directive('searchResults', $scope.searchOffset = parseInt(headers('X-Offset')) || 0; $scope.searchLimit = parseInt(headers('X-Limit')) || 0; $scope.searchResults = results; + showFullName($scope.searchResults); $scope.isSearching = false; } diff --git a/src/app/search/template/story_search_item.html b/src/app/search/template/story_search_item.html index 27a38027..fc1e7ae6 100644 --- a/src/app/search/template/story_search_item.html +++ b/src/app/search/template/story_search_item.html @@ -1,9 +1,9 @@ - + {{story.id}}: {{story.title | truncate: 97}} - @@ -22,14 +22,13 @@ - - + + + + + {{story[criteria]}} + + + - - - - - - - diff --git a/src/app/stories/template/list.html b/src/app/stories/template/list.html index 7d4c2c1c..ec5df3d7 100644 --- a/src/app/stories/template/list.html +++ b/src/app/stories/template/list.html @@ -65,6 +65,30 @@ on-page-size="updatePageSize(pageSize)" > +
+ Columns: + + + + +
@@ -92,40 +116,17 @@ - - - Created + + + {{queryFilters[column]}} + ng-if="sortField == column && sortDirection == 'desc'"> + ng-if="sortField == column && sortDirection == 'asc'"> - - - Updated - - - - - - - - - Status - - - - - - - diff --git a/src/theme/base/_stories.scss b/src/theme/base/_stories.scss index d784e609..b3506c82 100644 --- a/src/theme/base/_stories.scss +++ b/src/theme/base/_stories.scss @@ -39,4 +39,8 @@ .label .fa-times:hover{ cursor:pointer; opacity:1; +} + +#query .dropdown-menu > li{ + padding-left:1rem; } \ No newline at end of file