From c9ff3d5495b0229d837fa0ec23486cc7b6b191d0 Mon Sep 17 00:00:00 2001 From: Trygve Laugstøl Date: Fri, 28 Dec 2012 13:13:14 +0100 Subject: o Listing builds on the person view. --- src/main/webapp/apps/core/CoreResources.js | 17 +++++++++++++++++ src/main/webapp/apps/core/PersonService.js | 9 --------- src/main/webapp/apps/frontPageApp/frontPageApp.js | 21 ++++++++++++--------- src/main/webapp/apps/personApp/person.html | 7 +++++++ src/main/webapp/apps/personApp/personApp.js | 10 +++++++--- 5 files changed, 43 insertions(+), 21 deletions(-) create mode 100644 src/main/webapp/apps/core/CoreResources.js delete mode 100644 src/main/webapp/apps/core/PersonService.js (limited to 'src/main/webapp/apps') diff --git a/src/main/webapp/apps/core/CoreResources.js b/src/main/webapp/apps/core/CoreResources.js new file mode 100644 index 0000000..96d4b24 --- /dev/null +++ b/src/main/webapp/apps/core/CoreResources.js @@ -0,0 +1,17 @@ +'use strict'; + +function Person($resource) { + return $resource('/resource/core/person/:uuid', {uuid: '@uuid'}); +} + +angular. + module('person', ['ngResource']). + factory('Person', Person); + +function Build($resource) { + return $resource('/resource/core/build/:uuid', {uuid: '@uuid'}); +} + +angular. + module('build', ['ngResource']). + factory('Build', Build); diff --git a/src/main/webapp/apps/core/PersonService.js b/src/main/webapp/apps/core/PersonService.js deleted file mode 100644 index 75265a8..0000000 --- a/src/main/webapp/apps/core/PersonService.js +++ /dev/null @@ -1,9 +0,0 @@ -'use strict'; - -function PersonService($resource) { - return $resource('/resource/core/person/:uuid', {uuid: '@uuid'}); -} - -angular. - module('personService', ['ngResource']). - factory('PersonService', PersonService); diff --git a/src/main/webapp/apps/frontPageApp/frontPageApp.js b/src/main/webapp/apps/frontPageApp/frontPageApp.js index d92a163..c4fa0cc 100644 --- a/src/main/webapp/apps/frontPageApp/frontPageApp.js +++ b/src/main/webapp/apps/frontPageApp/frontPageApp.js @@ -1,11 +1,11 @@ 'use strict'; -var frontPageApp = angular.module('frontPageApp', ['ngGrid', 'personService']).config(function ($routeProvider, $locationProvider) { +var frontPageApp = angular.module('frontPageApp', ['ngGrid', 'person']).config(function ($routeProvider, $locationProvider) { $routeProvider. when('/', {controller: FrontPageCtrl, templateUrl: '/apps/frontPageApp/frontPage.html?noCache=' + noCache}); }); -function FrontPageCtrl($scope, $http, PersonService) { +function FrontPageCtrl($scope, $http, Person) { $scope.persons = []; $scope.pagingOptions = { @@ -19,6 +19,8 @@ function FrontPageCtrl($scope, $http, PersonService) { data: 'persons', displayFooter: true, enablePaging: true, + enableRowReordering: false, + enableColumnReordering: false, showFilter: false, showColumnMenu: false, canSelectRows: false, @@ -41,7 +43,8 @@ function FrontPageCtrl($scope, $http, PersonService) { $scope.setPagingData = function(data, page, pageSize){ // $scope.persons = data.slice((page - 1) * pageSize, page * pageSize); $scope.persons = data; - $scope.personsGridOptions.totalServerItems = data.length; +// $scope.personsGridOptions.totalServerItems = data.length; + window.x = $scope.personsGridOptions; if (!$scope.$$phase) { $scope.$apply(); } @@ -50,7 +53,7 @@ function FrontPageCtrl($scope, $http, PersonService) { $scope.getPagedDataAsync = function (pageSize, page/*, searchText*/) { setTimeout(function () { - PersonService.query({startIndex: page * pageSize, count: pageSize}, function (persons) { + Person.query({startIndex: page * pageSize, count: pageSize}, function (persons) { $scope.setPagingData(persons, page, pageSize); }); }, 100); @@ -60,9 +63,9 @@ function FrontPageCtrl($scope, $http, PersonService) { $scope.getPagedDataAsync($scope.pagingOptions.pageSize, $scope.pagingOptions.currentPage); }, true); - $http.get('/resource/core/person-count').success(function(count) { - $scope.pagingOptions.totalServerItems = count; - - $scope.getPagedDataAsync($scope.pagingOptions.pageSize, $scope.pagingOptions.currentPage); - }); +// $http.get('/resource/core/person-count').success(function(count) { +// $scope.pagingOptions.totalServerItems = count; +// +// $scope.getPagedDataAsync($scope.pagingOptions.pageSize, $scope.pagingOptions.currentPage); +// }); } diff --git a/src/main/webapp/apps/personApp/person.html b/src/main/webapp/apps/personApp/person.html index 4189f20..2c0c3e7 100644 --- a/src/main/webapp/apps/personApp/person.html +++ b/src/main/webapp/apps/personApp/person.html @@ -14,4 +14,11 @@ {{badge.name}} progress: {{badge.progress}} of {{badge.goal}}

+

Builds

+ + diff --git a/src/main/webapp/apps/personApp/personApp.js b/src/main/webapp/apps/personApp/personApp.js index 59f5a7d..8323c45 100644 --- a/src/main/webapp/apps/personApp/personApp.js +++ b/src/main/webapp/apps/personApp/personApp.js @@ -1,12 +1,16 @@ 'use strict'; -var personApp = angular.module('personApp', ['personService']).config(function ($routeProvider, $locationProvider) { +var personApp = angular.module('personApp', ['person', 'build']).config(function ($routeProvider, $locationProvider) { $routeProvider. when('/', {controller: PersonCtrl, templateUrl: '/apps/personApp/person.html?noCache=' + noCache}); }); -function PersonCtrl($scope, $location, PersonService) { - PersonService.get({uuid: uuid}, function (person) { +function PersonCtrl($scope, $location, Person, Build) { + Person.get({uuid: uuid}, function (person) { $scope.person = person; }); + + Build.query({person: uuid}, function (builds) { + $scope.builds = builds; + }); } -- cgit v1.2.3