diff options
author | Trygve Laugstøl <trygvis@inamo.no> | 2013-01-05 16:35:06 +0100 |
---|---|---|
committer | Trygve Laugstøl <trygvis@inamo.no> | 2013-01-05 16:35:06 +0100 |
commit | 7880fd60bb6ba5237d269a1b840a412c4438dd39 (patch) | |
tree | 4162d2826c79dde8955b9197bb8be9e27ca82b3f /src/main/webapp/apps/frontPageApp/frontPageApp.js | |
parent | c688292feaae9005644c83a14a26a420a570fae1 (diff) | |
download | esper-testing-7880fd60bb6ba5237d269a1b840a412c4438dd39.tar.gz esper-testing-7880fd60bb6ba5237d269a1b840a412c4438dd39.tar.bz2 esper-testing-7880fd60bb6ba5237d269a1b840a412c4438dd39.tar.xz esper-testing-7880fd60bb6ba5237d269a1b840a412c4438dd39.zip |
o Integrating the separate person app into the front page app.
Diffstat (limited to 'src/main/webapp/apps/frontPageApp/frontPageApp.js')
-rwxr-xr-x | src/main/webapp/apps/frontPageApp/frontPageApp.js | 39 |
1 files changed, 37 insertions, 2 deletions
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; + }); +} |