Merge "Added pagination directives"
This commit is contained in:
commit
0b1ee74f9e
@ -27,8 +27,6 @@ angular.module('sb.projects').controller('ProjectListController',
|
||||
|
||||
function resetScope() {
|
||||
$scope.projectCount = 0;
|
||||
$scope.projectOffset = 0;
|
||||
$scope.projectLimit = 10;
|
||||
$scope.projects = [];
|
||||
$scope.error = {};
|
||||
}
|
||||
@ -50,16 +48,9 @@ angular.module('sb.projects').controller('ProjectListController',
|
||||
{ /*q: $scope.searchQuery || ''*/},
|
||||
function (result, headers) {
|
||||
|
||||
// Extract metadata from returned headers.
|
||||
var projectCount = headers('X-List-Total') || result.length;
|
||||
var projectOffset = headers('X-List-Offset') || 0;
|
||||
var projectLimit = headers('X-List-Limit') || result.length;
|
||||
|
||||
// Successful search results, apply the results to the
|
||||
// scope and unset our progress flag.
|
||||
$scope.projectCount = projectCount;
|
||||
$scope.projectOffset = projectOffset;
|
||||
$scope.projectLimit = projectLimit;
|
||||
$scope.projectCount = headers('X-Total') || result.length;
|
||||
$scope.projects = result;
|
||||
$scope.isSearching = false;
|
||||
},
|
||||
|
@ -36,8 +36,6 @@ angular.module('sb.projects').controller('ProjectStoryListController',
|
||||
// Variables and methods available to the template...
|
||||
function resetScope() {
|
||||
$scope.storyCount = 0;
|
||||
$scope.storyOffset = 0;
|
||||
$scope.storyLimit = 10;
|
||||
$scope.stories = [];
|
||||
$scope.error = {};
|
||||
}
|
||||
@ -58,16 +56,9 @@ angular.module('sb.projects').controller('ProjectStoryListController',
|
||||
{project_id: id},
|
||||
function (result, headers) {
|
||||
|
||||
// Extract metadata from returned headers.
|
||||
var storyCount = headers('X-List-Total') || result.length;
|
||||
var storyOffset = headers('X-List-Offset') || 0;
|
||||
var storyLimit = headers('X-List-Limit') || result.length;
|
||||
|
||||
// Successful search results, apply the results to the
|
||||
// scope and unset our progress flag.
|
||||
$scope.storyCount = storyCount;
|
||||
$scope.storyOffset = storyOffset;
|
||||
$scope.storyLimit = storyLimit;
|
||||
$scope.storyCount = headers('X-Total') || result.length;
|
||||
$scope.stories = result;
|
||||
$scope.isSearching = false;
|
||||
},
|
||||
|
22
src/app/services/provider/page_size.js
Normal file
22
src/app/services/provider/page_size.js
Normal file
@ -0,0 +1,22 @@
|
||||
/*
|
||||
* Copyright (c) 2014 Hewlett-Packard Development Company, L.P.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
* not use this file except in compliance with the License. You may obtain
|
||||
* a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
* License for the specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* Our globally configured page size.
|
||||
*/
|
||||
|
||||
angular.module('sb.services').constant('pageSize', 500);
|
@ -21,7 +21,7 @@
|
||||
* @author Michael Krotscheck
|
||||
*/
|
||||
angular.module('sb.services')
|
||||
.factory('storyboardApiSignature', function () {
|
||||
.factory('storyboardApiSignature', function (pageSize) {
|
||||
'use strict';
|
||||
|
||||
return {
|
||||
@ -41,7 +41,10 @@ angular.module('sb.services')
|
||||
'query': {
|
||||
method: 'GET',
|
||||
isArray: true,
|
||||
responseType: 'json'
|
||||
responseType: 'json',
|
||||
params: {
|
||||
limit: pageSize
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
@ -29,8 +29,6 @@ angular.module('sb.story').controller('StoryListController',
|
||||
// Variables and methods available to the template...
|
||||
function resetScope() {
|
||||
$scope.storyCount = 0;
|
||||
$scope.storyOffset = 0;
|
||||
$scope.storyLimit = 10;
|
||||
$scope.stories = [];
|
||||
$scope.error = {};
|
||||
}
|
||||
@ -52,16 +50,9 @@ angular.module('sb.story').controller('StoryListController',
|
||||
{},
|
||||
function (result, headers) {
|
||||
|
||||
// Extract metadata from returned headers.
|
||||
var storyCount = headers('X-List-Total') || result.length;
|
||||
var storyOffset = headers('X-List-Offset') || 0;
|
||||
var storyLimit = headers('X-List-Limit') || result.length;
|
||||
|
||||
// Successful search results, apply the results to the
|
||||
// scope and unset our progress flag.
|
||||
$scope.storyCount = storyCount;
|
||||
$scope.storyOffset = storyOffset;
|
||||
$scope.storyLimit = storyLimit;
|
||||
$scope.storyCount = headers('X-Total') || result.length;
|
||||
$scope.stories = result;
|
||||
$scope.isSearching = false;
|
||||
},
|
||||
|
Loading…
x
Reference in New Issue
Block a user