Merge "Added pagination directives"
This commit is contained in:
commit
0b1ee74f9e
@ -27,8 +27,6 @@ angular.module('sb.projects').controller('ProjectListController',
|
|||||||
|
|
||||||
function resetScope() {
|
function resetScope() {
|
||||||
$scope.projectCount = 0;
|
$scope.projectCount = 0;
|
||||||
$scope.projectOffset = 0;
|
|
||||||
$scope.projectLimit = 10;
|
|
||||||
$scope.projects = [];
|
$scope.projects = [];
|
||||||
$scope.error = {};
|
$scope.error = {};
|
||||||
}
|
}
|
||||||
@ -50,16 +48,9 @@ angular.module('sb.projects').controller('ProjectListController',
|
|||||||
{ /*q: $scope.searchQuery || ''*/},
|
{ /*q: $scope.searchQuery || ''*/},
|
||||||
function (result, headers) {
|
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
|
// Successful search results, apply the results to the
|
||||||
// scope and unset our progress flag.
|
// scope and unset our progress flag.
|
||||||
$scope.projectCount = projectCount;
|
$scope.projectCount = headers('X-Total') || result.length;
|
||||||
$scope.projectOffset = projectOffset;
|
|
||||||
$scope.projectLimit = projectLimit;
|
|
||||||
$scope.projects = result;
|
$scope.projects = result;
|
||||||
$scope.isSearching = false;
|
$scope.isSearching = false;
|
||||||
},
|
},
|
||||||
|
@ -36,8 +36,6 @@ angular.module('sb.projects').controller('ProjectStoryListController',
|
|||||||
// Variables and methods available to the template...
|
// Variables and methods available to the template...
|
||||||
function resetScope() {
|
function resetScope() {
|
||||||
$scope.storyCount = 0;
|
$scope.storyCount = 0;
|
||||||
$scope.storyOffset = 0;
|
|
||||||
$scope.storyLimit = 10;
|
|
||||||
$scope.stories = [];
|
$scope.stories = [];
|
||||||
$scope.error = {};
|
$scope.error = {};
|
||||||
}
|
}
|
||||||
@ -58,16 +56,9 @@ angular.module('sb.projects').controller('ProjectStoryListController',
|
|||||||
{project_id: id},
|
{project_id: id},
|
||||||
function (result, headers) {
|
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
|
// Successful search results, apply the results to the
|
||||||
// scope and unset our progress flag.
|
// scope and unset our progress flag.
|
||||||
$scope.storyCount = storyCount;
|
$scope.storyCount = headers('X-Total') || result.length;
|
||||||
$scope.storyOffset = storyOffset;
|
|
||||||
$scope.storyLimit = storyLimit;
|
|
||||||
$scope.stories = result;
|
$scope.stories = result;
|
||||||
$scope.isSearching = false;
|
$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
|
* @author Michael Krotscheck
|
||||||
*/
|
*/
|
||||||
angular.module('sb.services')
|
angular.module('sb.services')
|
||||||
.factory('storyboardApiSignature', function () {
|
.factory('storyboardApiSignature', function (pageSize) {
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
return {
|
return {
|
||||||
@ -41,7 +41,10 @@ angular.module('sb.services')
|
|||||||
'query': {
|
'query': {
|
||||||
method: 'GET',
|
method: 'GET',
|
||||||
isArray: true,
|
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...
|
// Variables and methods available to the template...
|
||||||
function resetScope() {
|
function resetScope() {
|
||||||
$scope.storyCount = 0;
|
$scope.storyCount = 0;
|
||||||
$scope.storyOffset = 0;
|
|
||||||
$scope.storyLimit = 10;
|
|
||||||
$scope.stories = [];
|
$scope.stories = [];
|
||||||
$scope.error = {};
|
$scope.error = {};
|
||||||
}
|
}
|
||||||
@ -52,16 +50,9 @@ angular.module('sb.story').controller('StoryListController',
|
|||||||
{},
|
{},
|
||||||
function (result, headers) {
|
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
|
// Successful search results, apply the results to the
|
||||||
// scope and unset our progress flag.
|
// scope and unset our progress flag.
|
||||||
$scope.storyCount = storyCount;
|
$scope.storyCount = headers('X-Total') || result.length;
|
||||||
$scope.storyOffset = storyOffset;
|
|
||||||
$scope.storyLimit = storyLimit;
|
|
||||||
$scope.stories = result;
|
$scope.stories = result;
|
||||||
$scope.isSearching = false;
|
$scope.isSearching = false;
|
||||||
},
|
},
|
||||||
|
Loading…
x
Reference in New Issue
Block a user