From 4a6c9c52d006ecb717bae7d9b502d9b661a08ccd Mon Sep 17 00:00:00 2001 From: Trygve Laugstøl Date: Fri, 4 Jan 2013 10:18:56 +0100 Subject: o Using the PagingTableService on the front page and person apps. --- src/main/webapp/apps/personApp/personApp.js | 33 +++++------------------------ 1 file changed, 5 insertions(+), 28 deletions(-) mode change 100644 => 100755 src/main/webapp/apps/personApp/personApp.js (limited to 'src/main/webapp/apps/personApp') diff --git a/src/main/webapp/apps/personApp/personApp.js b/src/main/webapp/apps/personApp/personApp.js old mode 100644 new mode 100755 index 8c13669..e8ef1d5 --- 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; -- cgit v1.2.3