aboutsummaryrefslogtreecommitdiff
path: root/src/main/webapp/apps/personApp/personApp.js
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/webapp/apps/personApp/personApp.js')
-rwxr-xr-x[-rw-r--r--]src/main/webapp/apps/personApp/personApp.js33
1 files changed, 5 insertions, 28 deletions
diff --git a/src/main/webapp/apps/personApp/personApp.js b/src/main/webapp/apps/personApp/personApp.js
index 8c13669..e8ef1d5 100644..100755
--- a/src/main/webapp/apps/personApp/personApp.js
+++ b/src/main/webapp/apps/personApp/personApp.js
@@ -1,39 +1,16 @@
'use strict';
-var personApp = angular.module('personApp', ['person', 'build']).config(function ($routeProvider, $locationProvider) {
+var personApp = angular.module('personApp', ['person', 'build', 'pagingTableService']).config(function ($routeProvider, $locationProvider) {
$routeProvider.
when('/', {controller: PersonCtrl, templateUrl: '/apps/personApp/person.html?noCache=' + noCache});
});
-function PersonCtrl($scope, $location, Person, Build) {
- function queryBuilds() {
- var builds = $scope.builds;
- Build.query({person: uuid, startIndex: builds.startIndex, count: builds.count}, function (builds) {
- $scope.builds.rows = builds;
- });
- }
+function PersonCtrl($scope, $routeParams, Person, Build, PagingTableService) {
+ var personUuid = uuid;
$scope.mode = 'overview';
- $scope.builds = {
- rows: [],
- startIndex: 0,
- count: 10,
- first: function() {
- $scope.builds.startIndex = 0;
- queryBuilds();
- },
- next: function() {
- $scope.builds.startIndex += $scope.builds.count;
- queryBuilds();
- },
- prev: function() {
- if($scope.builds.startIndex == 0) {
- return;
- }
- $scope.builds.startIndex -= $scope.builds.count;
- queryBuilds();
- }
- };
+
+ $scope.builds = PagingTableService.create($scope, PagingTableService.defaultCallback(Build, {person: personUuid}));
$scope.setMode = function(mode) {
$scope.mode = mode;