Add the parameter parsing functionality to all of the search views
This commit makes it possible to link to a search/browse in the "search", "project groups", and "projects" views in addition to just the story list. Change-Id: Id36d717c65f57a458b2144a87be4b8c04a9e6051
This commit is contained in:
parent
dbc72feb87
commit
739de718e7
@ -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.
|
||||
*/
|
||||
|
@ -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.
|
||||
*/
|
||||
|
@ -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);
|
||||
}
|
||||
);
|
||||
|
Loading…
x
Reference in New Issue
Block a user