diff --git a/src/app/project_group/controller/project_group_list_controller.js b/src/app/project_group/controller/project_group_list_controller.js index 865d90de..13f52603 100644 --- a/src/app/project_group/controller/project_group_list_controller.js +++ b/src/app/project_group/controller/project_group_list_controller.js @@ -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. */ diff --git a/src/app/projects/controller/project_list_controller.js b/src/app/projects/controller/project_list_controller.js index 333c9e11..d0fb94cd 100644 --- a/src/app/projects/controller/project_list_controller.js +++ b/src/app/projects/controller/project_list_controller.js @@ -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. */ diff --git a/src/app/search/controller/search_controller.js b/src/app/search/controller/search_controller.js index 796f4a1b..86108ed6 100644 --- a/src/app/search/controller/search_controller.js +++ b/src/app/search/controller/search_controller.js @@ -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); } );