Merge "Add the parameter parsing functionality to all of the search views"

This commit is contained in:
Jenkins 2017-08-11 15:32:28 +00:00 committed by Gerrit Code Review
commit cbe963b4ed
3 changed files with 12 additions and 8 deletions

View File

@ -18,7 +18,8 @@
* A Project
*/
angular.module('sb.project_group').controller('ProjectGroupListController',
function ($scope, $modal, SubscriptionList, CurrentUser, $state) {
function ($scope, $modal, SubscriptionList, CurrentUser, $state,
$location, SearchHelper) {
'use strict';
// search results must be of type "ProjectGroup"
@ -27,6 +28,9 @@ angular.module('sb.project_group').controller('ProjectGroupListController',
// Projects have no default criteria
$scope.defaultCriteria = [];
var params = $location.search();
SearchHelper.parseParameters(params, $scope.defaultCriteria);
/**
* Create a new project-group.
*/

View File

@ -20,7 +20,8 @@
* rather than a browse (exclusive) approach.
*/
angular.module('sb.projects').controller('ProjectListController',
function ($scope, $modal, isSuperuser, SubscriptionList, CurrentUser) {
function ($scope, $modal, isSuperuser, SubscriptionList, CurrentUser,
$location, SearchHelper) {
'use strict';
// inject superuser flag to properly adjust UI.
@ -32,6 +33,9 @@ angular.module('sb.projects').controller('ProjectListController',
// Projects have no default criteria
$scope.defaultCriteria = [];
var params = $location.search();
SearchHelper.parseParameters(params, $scope.defaultCriteria);
/**
* Launches the add-project modal.
*/

View File

@ -18,7 +18,7 @@
* This controller provides initialization logic for the generic search view.
*/
angular.module('sb.search').controller('SearchController',
function ($log, $q, $scope, Criteria, $location) {
function ($log, $q, $scope, Criteria, $location, SearchHelper) {
'use strict';
/**
@ -40,10 +40,6 @@ angular.module('sb.search').controller('SearchController',
* If a 'q' exists in the state params, go ahead and add it.
*/
var params = $location.search();
if (params.hasOwnProperty('q') && !!params.q) {
$scope.defaultCriteria.push(
Criteria.create('Text', params.q)
);
}
SearchHelper.parseParameters(params, $scope.defaultCriteria);
}
);