From 7880fd60bb6ba5237d269a1b840a412c4438dd39 Mon Sep 17 00:00:00 2001 From: Trygve Laugstøl Date: Sat, 5 Jan 2013 16:35:06 +0100 Subject: o Integrating the separate person app into the front page app. --- src/main/webapp/apps/frontPageApp/frontPage.html | 4 +- src/main/webapp/apps/frontPageApp/frontPageApp.js | 39 +++++++++++- src/main/webapp/apps/frontPageApp/person.html | 77 +++++++++++++++++++++++ 3 files changed, 116 insertions(+), 4 deletions(-) create mode 100755 src/main/webapp/apps/frontPageApp/person.html (limited to 'src/main/webapp/apps/frontPageApp') diff --git a/src/main/webapp/apps/frontPageApp/frontPage.html b/src/main/webapp/apps/frontPageApp/frontPage.html index 64c97ad..b121935 100755 --- a/src/main/webapp/apps/frontPageApp/frontPage.html +++ b/src/main/webapp/apps/frontPageApp/frontPage.html @@ -9,7 +9,7 @@
@@ -25,7 +25,7 @@ - {{person.person.name}} + {{person.person.name}} {{person.badges.length}} diff --git a/src/main/webapp/apps/frontPageApp/frontPageApp.js b/src/main/webapp/apps/frontPageApp/frontPageApp.js index d5af99f..7678f0d 100755 --- a/src/main/webapp/apps/frontPageApp/frontPageApp.js +++ b/src/main/webapp/apps/frontPageApp/frontPageApp.js @@ -1,11 +1,46 @@ 'use strict'; -var frontPageApp = angular.module('frontPageApp', ['ngGrid', 'person', 'badge', 'pagingTableService', 'core.directives']).config(function ($routeProvider, $locationProvider) { +var frontPageApp = angular.module('frontPageApp', ['ngGrid', 'person', 'badge', 'build', 'pagingTableService', 'core.directives']).config(function ($routeProvider, $locationProvider) { $routeProvider. - when('/', {controller: FrontPageCtrl, templateUrl: '/apps/frontPageApp/frontPage.html?noCache=' + noCache}); + when('/', {controller: FrontPageCtrl, templateUrl: '/apps/frontPageApp/frontPage.html?noCache=' + noCache}). + when('/person/:personUuid', {controller: PersonCtrl, templateUrl: '/apps/frontPageApp/person.html?noCache=' + noCache}); }); function FrontPageCtrl($scope, Person, Badge, PagingTableService) { $scope.persons = PagingTableService.create($scope, PagingTableService.defaultCallback(Person)); $scope.recentBadges = Badge.query(); } + +function PersonCtrl($scope, $routeParams, Person, Badge, Build, PagingTableService) { + var personUuid = $routeParams.personUuid; + + $scope.mode = 'overview'; + + $scope.builds = PagingTableService.create($scope, PagingTableService.defaultCallback(Build, {person: personUuid})); + + $scope.setMode = function(mode) { + $scope.mode = mode; + switch(mode) { + case 'builds': + var builds = $scope.builds; + + console.log("$scope.builds.length=" + builds.rows.length); + if (builds.rows.length == 0) { + $scope.builds.first(); + } + break; + } + }; + + Person.get({uuid: personUuid}, function (person) { + $scope.person = person; + }); + + Build.query({person: personUuid}, function (builds) { + $scope.recentBuilds = builds; + }); + + Badge.query({person: personUuid}, function (badges) { + $scope.badges = badges; + }); +} diff --git a/src/main/webapp/apps/frontPageApp/person.html b/src/main/webapp/apps/frontPageApp/person.html new file mode 100755 index 0000000..3544221 --- /dev/null +++ b/src/main/webapp/apps/frontPageApp/person.html @@ -0,0 +1,77 @@ +
+ + + + + + + +
+

Badges

+ +

+ {{badge.name}} x {{badge.count}} +

+ +
+
+
{{badge.name}}
+
+
+ +

Recent builds

+ + + + + + + + + + + + + + + +
DateSuccess
{{build.timestamp | date:'medium'}}{{build.success}}Details
+
+ +
+

Builds

+ + + + + + + + + + + + + + + + + + +
DateSuccess
{{build.timestamp | date:'medium'}}{{build.success}}
+ +
+
+
-- cgit v1.2.3