diff options
Diffstat (limited to 'src/main/webapp/apps/frontPageApp')
-rwxr-xr-x | src/main/webapp/apps/frontPageApp/frontPage.html | 4 | ||||
-rwxr-xr-x | src/main/webapp/apps/frontPageApp/frontPageApp.js | 39 | ||||
-rwxr-xr-x | src/main/webapp/apps/frontPageApp/person.html | 77 |
3 files changed, 116 insertions, 4 deletions
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 @@ <div> <ul class="inline"> <li ng-repeat="b in recentBadges"> - <a href="/person/{{b.person.uuid}}/"> {{b.person.name}} </a> + <a href="#/person/{{b.person.uuid}}"> {{b.person.name}} </a> <span class="badge-level-{{badge.level}} badge">{{b.badge.name}}</span> </li> </ul> @@ -25,7 +25,7 @@ </thead> <tbody> <tr ng-repeat="person in persons.rows"> - <td><a href="/person/{{person.person.uuid}}/">{{person.person.name}}</a></td> + <td><a href="#/person/{{person.person.uuid}}">{{person.person.name}}</a></td> <td>{{person.badges.length}}</td> </tr> </tbody> 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 @@ +<div class="container"> + + <navbar/> + + <div class="page-header"> + <h1>{{person.name}}</h1> + </div> + + <ul class="nav nav-tabs"> + <li ng-class="{active: mode == 'overview'}"><a ng-click="setMode('overview')">Overview</a></li> + <li ng-class="{active: mode == 'builds'}"><a ng-click="setMode('builds')">Builds</a></li> + </ul> + + <div id="overview" ng-show="mode == 'overview'"> + <h3>Badges</h3> + + <p ng-repeat="badge in person.badges"> + <span class="badge-level-{{badge.level}} badge">{{badge.name}}</span><span ng-show="badge.count > 1"> x {{badge.count}}</span> + </p> + + <div ng-repeat="badge in person.badgesInProgress"> + <div class="progress"> + <div class="bar" style="width: {{badge.progress / badge.goal * 100}}%;">{{badge.name}}</div> + </div> + </div> + + <h3>Recent builds</h3> + <table class="table"> + <thead> + <tr> + <th>Date</th> + <th>Success</th> + <th></th> + </tr> + </thead> + <tbody> + <tr ng-repeat="build in recentBuilds" class="{{{true: 'success', false: 'error'}[build.success]}}"> + <td>{{build.timestamp | date:'medium'}}</td> + <td>{{build.success}}</td> + <td><a href="/build/{{build.uuid}}">Details</a></td> + </tr> + </tbody> + </table> + </div> + + <div id="builds" ng-show="mode == 'builds'"> + <h3>Builds</h3> + <table class="table"> + <thead> + <tr> + <th>Date</th> + <th>Success</th> + </tr> + </thead> + <tbody> + <tr ng-repeat="build in builds.rows" class="{{{true: 'success', false: 'error'}[build.success]}}"> + <td>{{build.timestamp | date:'medium'}}</td> + <td>{{build.success}}</td> + </tr> + </tbody> + <tfoot> + <tr> + <td colspan="2"> + <ul class="pager"> + <li class="previous" ng-class="{disabled: builds.startIndex == 0}"> + <a ng-click="builds.prev()">← Older</a> + </li> + <li class="next"> + <a ng-click="builds.next()">Newer →</a> + </li> + </ul> + </td> + </tr> + </tfoot> + </table> + </div> +</div> |