From 39636be7b018b9121696ce7bdc462ab2c3c8185d Mon Sep 17 00:00:00 2001 From: Trygve Laugstøl Date: Fri, 11 Jan 2013 17:11:28 +0100 Subject: o Creating bin/web for running the web application. --- .../resources/webapp/apps/frontPageApp/badge.html | 30 ++++++ .../webapp/apps/frontPageApp/badgeList.html | 46 +++++++++ .../webapp/apps/frontPageApp/buildList.html | 50 ++++++++++ .../webapp/apps/frontPageApp/frontPage.html | 31 ++++++ .../webapp/apps/frontPageApp/frontPageApp.js | 110 +++++++++++++++++++++ .../resources/webapp/apps/frontPageApp/person.html | 100 +++++++++++++++++++ .../webapp/apps/frontPageApp/personList.html | 47 +++++++++ 7 files changed, 414 insertions(+) create mode 100755 src/main/resources/webapp/apps/frontPageApp/badge.html create mode 100755 src/main/resources/webapp/apps/frontPageApp/badgeList.html create mode 100755 src/main/resources/webapp/apps/frontPageApp/buildList.html create mode 100755 src/main/resources/webapp/apps/frontPageApp/frontPage.html create mode 100755 src/main/resources/webapp/apps/frontPageApp/frontPageApp.js create mode 100755 src/main/resources/webapp/apps/frontPageApp/person.html create mode 100755 src/main/resources/webapp/apps/frontPageApp/personList.html (limited to 'src/main/resources/webapp/apps/frontPageApp') diff --git a/src/main/resources/webapp/apps/frontPageApp/badge.html b/src/main/resources/webapp/apps/frontPageApp/badge.html new file mode 100755 index 0000000..92fc7ae --- /dev/null +++ b/src/main/resources/webapp/apps/frontPageApp/badge.html @@ -0,0 +1,30 @@ +
+ + + + + +
+
+ The badge was awarded to at + {{badge.badge.createdDate | date:'medium'}}. +
+
+ +
+
+

Details

+

+ The badge was awarded for having {{badge.personalBadge.builds.length}} successful builds in a row: +

+ +
+
+ +
diff --git a/src/main/resources/webapp/apps/frontPageApp/badgeList.html b/src/main/resources/webapp/apps/frontPageApp/badgeList.html new file mode 100755 index 0000000..7671a55 --- /dev/null +++ b/src/main/resources/webapp/apps/frontPageApp/badgeList.html @@ -0,0 +1,46 @@ +
+ + + + + + + +
+
+
+
+

{{date | date:'mediumDate'}}

+
+
+
+
+ +
+ +
+
+
+ +
+
+
diff --git a/src/main/resources/webapp/apps/frontPageApp/buildList.html b/src/main/resources/webapp/apps/frontPageApp/buildList.html new file mode 100755 index 0000000..13a1dc3 --- /dev/null +++ b/src/main/resources/webapp/apps/frontPageApp/buildList.html @@ -0,0 +1,50 @@ +
+ + + + + + + +
+
+ + + + + + + + + + + +
{{build.build.timestamp | date:'medium'}} + SUCCESS + FAILURE +
+ + + +
+ +
+
+
diff --git a/src/main/resources/webapp/apps/frontPageApp/frontPage.html b/src/main/resources/webapp/apps/frontPageApp/frontPage.html new file mode 100755 index 0000000..c3db55c --- /dev/null +++ b/src/main/resources/webapp/apps/frontPageApp/frontPage.html @@ -0,0 +1,31 @@ +
+ + + + +
+
+

Badges

+ +
+
    +
  • + +
  • +
+
+
+ +
+

Newcomers

+ + +
+
+
diff --git a/src/main/resources/webapp/apps/frontPageApp/frontPageApp.js b/src/main/resources/webapp/apps/frontPageApp/frontPageApp.js new file mode 100755 index 0000000..6f80d0f --- /dev/null +++ b/src/main/resources/webapp/apps/frontPageApp/frontPageApp.js @@ -0,0 +1,110 @@ +'use strict'; + +var frontPageApp = angular.module('frontPageApp', ['ngGrid', 'person', 'badge', 'build', 'pagingTableService', 'core.directives']).config(function ($routeProvider) { + $routeProvider. + when('/', {controller: FrontPageCtrl, templateUrl: '/apps/frontPageApp/frontPage.html?noCache=' + noCache}). + when('/badge/', {controller: BadgeListCtrl, templateUrl: '/apps/frontPageApp/badgeList.html?noCache=' + noCache}). + when('/badge/:badgeUuid', {controller: BadgeCtrl, templateUrl: '/apps/frontPageApp/badge.html?noCache=' + noCache}). + when('/person/', {controller: PersonListCtrl, templateUrl: '/apps/frontPageApp/personList.html?noCache=' + noCache}). + when('/person/:personUuid', {controller: PersonCtrl, templateUrl: '/apps/frontPageApp/person.html?noCache=' + noCache}). + when('/build/', {controller: BuildListCtrl, templateUrl: '/apps/frontPageApp/buildList.html?noCache=' + noCache}); +}); + +function FrontPageCtrl($scope, Person, Badge) { + $scope.persons = Person.query(); + $scope.recentBadges = Badge.query(); +} + +function groupBy(array, size) { + var group = []; + var groups = []; + angular.forEach(array, function (element) { + group.push(element); + if (group.length == size) { + groups.push(group); + group = []; + } + }); + + if (group.length != 0) { + groups.push(group); + } + return groups; +} + +function BadgeListCtrl($scope, Badge, PagingTableService) { + var groupSize = 6; + + var personsWatcher = function () { + var withDay = _.map($scope.badges.rows, function(badge) { + badge.day = new Date(badge.badge.createdDate).clearTime().getTime(); +// badge.day.clearTime(); + return badge; + }); + + var byDay = _.groupBy(withDay, 'day'); + console.log("byDay", byDay); +// var dateGroups = _.map(byDay, function(group, date) { +// return {date: groupBy(group, groupSize)} +// }); + + $scope.badgeGroups = byDay; + }; + + $scope.badges = PagingTableService.create($scope, PagingTableService.defaultCallback(Badge), + {count: groupSize * 6, watcher: personsWatcher}); + + $scope.badgeGroups = []; +} + +function BadgeCtrl($scope, $routeParams, Badge) { + var badgeUuid = $routeParams.badgeUuid; + Badge.get({uuid: badgeUuid}, function (badge) { + $scope.badge = badge; + }); +} + +function PersonListCtrl($scope, Person, PagingTableService) { + var groupSize = 4; + var personsWatcher = function () { + $scope.personGroups = groupBy($scope.persons.rows, groupSize); + }; + + $scope.persons = PagingTableService.create($scope, PagingTableService.defaultCallback(Person, {orderBy: "name"}), + {count: groupSize * 6, watcher: personsWatcher}); + + $scope.personGroups = []; +} + +function PersonCtrl($scope, $routeParams, Person, 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; + }); +} + +function BuildListCtrl($scope, Build, PagingTableService) { + $scope.builds = PagingTableService.create($scope, PagingTableService.defaultCallback(Build, {fields: "detailed"})); +} diff --git a/src/main/resources/webapp/apps/frontPageApp/person.html b/src/main/resources/webapp/apps/frontPageApp/person.html new file mode 100755 index 0000000..ba5c18d --- /dev/null +++ b/src/main/resources/webapp/apps/frontPageApp/person.html @@ -0,0 +1,100 @@ +
+ + + + + + + +
+
+

Upcoming

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

Badges

+
    +
  • + + {{badge.name}} + + + + + + {{badge.createdDate | date:'medium'}} +
  • +
+
+
+

Recent builds

+ + + + + + + + + + + +
{{build.timestamp | date:'medium'}}{{{true: 'Success', false: 'Failure'}[build.success]}}Details
+
+
+ +
+

Builds

+ + + + + + + + + + + + + + + + + + +
DateSuccess
{{build.timestamp | date:'medium'}}{{build.success}}
+ +
+
+
diff --git a/src/main/resources/webapp/apps/frontPageApp/personList.html b/src/main/resources/webapp/apps/frontPageApp/personList.html new file mode 100755 index 0000000..5d7d8c6 --- /dev/null +++ b/src/main/resources/webapp/apps/frontPageApp/personList.html @@ -0,0 +1,47 @@ +
+ + + + + + + +
+
+
+
+
+ + {{person.person.name}} +
+ + x {{level}} + +
+
+
+ +
+
+
-- cgit v1.2.3