Switched usage of resource.query() to resource.browse()

We build a fancy resource factory which created a search() and browse()
method with lots of fancy features, and then didn't use it. This fixes
that, which propagates user preferences such as paging throughout the
application.

Change-Id: If5a36cb9e579755d2310cfa5275a308d6d0ee3b8
This commit is contained in:
Michael Krotscheck
2014-11-03 12:39:36 +01:00
parent 05101c200d
commit c1faa25786
16 changed files with 19 additions and 19 deletions

View File

@@ -79,7 +79,7 @@ angular.module('sb.admin').controller('ProjectGroupAdminController',
$scope.search = function () {
var searchQuery = $scope.filterQuery || '';
$scope.projectGroups = ProjectGroup.query({
$scope.projectGroups = ProjectGroup.browse({
title: searchQuery
});
};

View File

@@ -54,7 +54,7 @@ angular.module('sb.admin').controller('ProjectGroupEditController',
*/
$scope.searchProjects = function (value) {
var deferred = $q.defer();
Project.query({name: value, limit: 10},
Project.browse({name: value, limit: 10},
function (results) {
// Dedupe the results.
var idxList = [];

View File

@@ -31,7 +31,7 @@ angular.module('sb.admin').controller('ProjectGroupItemController',
var id = $scope.projectGroup.id;
$scope.loadingProjectGroupItems = true;
ProjectGroupItem.query({
ProjectGroupItem.browse({
projectGroupId: id
},
function (results) {

View File

@@ -50,7 +50,7 @@ angular.module('sb.admin').controller('ProjectGroupNewController',
*/
$scope.searchProjects = function (value) {
var deferred = $q.defer();
Project.query({name: value, limit: 10},
Project.browse({name: value, limit: 10},
function (results) {
// Dedupe the results.
var idxList = [];

View File

@@ -55,7 +55,7 @@ angular.module('sb.admin').controller('UserAdminController',
$scope.search = function () {
var searchQuery = $scope.filterQuery || '';
$scope.users = User.query({
$scope.users = User.browse({
full_name: searchQuery
});
};

View File

@@ -73,7 +73,7 @@ angular.module('sb.admin', [ 'sb.services', 'sb.templates', 'sb.util',
return ProjectGroup.get({id: $stateParams.id}).$promise;
},
projects: function ($stateParams, ProjectGroupItem) {
return ProjectGroupItem.query(
return ProjectGroupItem.browse(
{projectGroupId: $stateParams.id}
).$promise;
}

View File

@@ -22,13 +22,13 @@ angular.module('sb.dashboard').controller('DashboardController',
'use strict';
// Load the list of current assigned stories.
$scope.assignedStories = Story.query({
$scope.assignedStories = Story.browse({
assignee_id: currentUser.id,
status: 'active'
});
// Load the user's subscription events.
$scope.subscriptionEvents = SubscriptionEvent.query({
$scope.subscriptionEvents = SubscriptionEvent.browse({
subscriber_id: currentUser.id
});

View File

@@ -61,7 +61,7 @@ angular.module('sb.projects').controller('ProjectStoryListController',
$scope.isSearching = true;
// Execute the story query.
Story.query(
Story.browse(
{project_id: id, status: $scope.filter || null},
function (result, headers) {

View File

@@ -131,7 +131,7 @@ angular.module('sb.search').directive('searchResults',
params.sort_field = $scope.sortField;
params.sort_dir = $scope.sortDirection;
resource.query(params,
resource.browse(params,
handleSearchResult,
handleErrorResult);
} else {

View File

@@ -159,7 +159,7 @@ angular.module('sb.services')
queryParams[nameField] = searchString;
queryParams.limit = pageSize;
resource.query(queryParams,
resource.browse(queryParams,
function (result) {
// Transform the results to criteria tags.
var criteriaResults = [];

View File

@@ -100,7 +100,7 @@ angular.module('sb.story').controller('StoryDetailController',
* User typeahead search method.
*/
$scope.searchUsers = function (value) {
return User.query({full_name: value, limit: 10}).$promise;
return User.browse({full_name: value, limit: 10}).$promise;
};
/**

View File

@@ -30,7 +30,7 @@ angular.module('sb.story').controller('StoryDiscussionController',
/**
* The story we're manipulating right now.
*/
$scope.events = TimelineEvent.query({story_id: id});
$scope.events = TimelineEvent.browse({story_id: id});
/**
* The new comment backing the input form.

View File

@@ -21,7 +21,7 @@ angular.module('sb.story').controller('StoryModalController',
function ($scope, $modalInstance, params, Project, Story, Task) {
'use strict';
$scope.projects = Project.query({});
$scope.projects = Project.browse({});
$scope.story = new Story({title: ''});
$scope.tasks = [new Task({
title: '',
@@ -109,7 +109,7 @@ angular.module('sb.story').controller('StoryModalController',
* Project typeahead search method.
*/
$scope.searchProjects = function (value) {
return Project.query({name: value, limit: 10}).$promise;
return Project.browse({name: value, limit: 10}).$promise;
};
/**

View File

@@ -64,7 +64,7 @@ angular.module('sb.story').controller('StoryTaskListController',
$scope.loadTasks = function() {
$scope.tasks = [];
Task.query(
Task.browse(
{story_id: id},
function (result) {
$scope.tasks = result;

View File

@@ -95,14 +95,14 @@ angular.module('sb.story').directive('taskEditForm',
* User typeahead search method.
*/
$scope.searchUsers = function (value) {
return User.query({full_name: value, limit: 10}).$promise;
return User.browse({full_name: value, limit: 10}).$promise;
};
/**
* Project typeahead search method.
*/
$scope.searchProjects = function (value) {
return Project.query({name: value, limit: 10}).$promise;
return Project.browse({name: value, limit: 10}).$promise;
};
}
};

View File

@@ -118,7 +118,7 @@ angular.module('sb.util').directive('subscribe',
cuPromise.then(
function (user) {
Subscription.query({
Subscription.browse({
user_id: user.id,
target_type: $scope.resource,
target_id: $scope.resourceId