aboutsummaryrefslogtreecommitdiff
path: root/src/main
diff options
context:
space:
mode:
Diffstat (limited to 'src/main')
-rwxr-xr-xsrc/main/java/io/trygvis/esper/testing/Util.java24
-rwxr-xr-xsrc/main/java/io/trygvis/esper/testing/core/db/PersonDao.java3
-rwxr-xr-xsrc/main/resources/webapp/apps/frontPageApp/badgeList.html22
-rwxr-xr-xsrc/main/resources/webapp/apps/frontPageApp/frontPageApp.js33
-rwxr-xr-xsrc/main/resources/webapp/apps/frontPageApp/person.html2
5 files changed, 52 insertions, 32 deletions
diff --git a/src/main/java/io/trygvis/esper/testing/Util.java b/src/main/java/io/trygvis/esper/testing/Util.java
index 6b9d1b6..68660c4 100755
--- a/src/main/java/io/trygvis/esper/testing/Util.java
+++ b/src/main/java/io/trygvis/esper/testing/Util.java
@@ -89,16 +89,20 @@ public class Util {
}
for (String s : allowed) {
- if (s.equals(input)) {
- if (buffer.length() == 0) {
- buffer.append(" ORDER BY ");
- } else {
- buffer.append(", ");
- }
- buffer.append(s);
- if (desc) {
- buffer.append(" DESC");
- }
+ if (!s.equals(input)) {
+ continue;
+ }
+
+ if (buffer.length() == 0) {
+ buffer.append(" ORDER BY ");
+ } else {
+ buffer.append(", ");
+ }
+
+ buffer.append(s);
+
+ if (desc) {
+ buffer.append(" DESC");
}
}
}
diff --git a/src/main/java/io/trygvis/esper/testing/core/db/PersonDao.java b/src/main/java/io/trygvis/esper/testing/core/db/PersonDao.java
index 58af119..8d74264 100755
--- a/src/main/java/io/trygvis/esper/testing/core/db/PersonDao.java
+++ b/src/main/java/io/trygvis/esper/testing/core/db/PersonDao.java
@@ -198,7 +198,8 @@ public class PersonDao {
sql += " AND level=?";
}
- sql += " ORDER BY created_date DESC";
+ sql += orderBy(page.orderBy, "name", "created_date");
+
sql += " LIMIT ? OFFSET ?";
try (PreparedStatement s = c.prepareStatement(sql)) {
diff --git a/src/main/resources/webapp/apps/frontPageApp/badgeList.html b/src/main/resources/webapp/apps/frontPageApp/badgeList.html
index 7671a55..972e1ec 100755
--- a/src/main/resources/webapp/apps/frontPageApp/badgeList.html
+++ b/src/main/resources/webapp/apps/frontPageApp/badgeList.html
@@ -20,18 +20,20 @@
<div class="row">
<div class="span12">
- <div class="row" ng-repeat="(date, group) in badgeGroups">
- <div class="span12">
- <h2>{{date | date:'mediumDate'}}</h2>
- </div>
- <div class="span12">
- <div class="awarded-badge pull-left" ng-repeat="badge in group">
- <div><person-avatar person="badge.person"></person-avatar></div>
+ <div class="row" ng-repeat="g in badgeGroups">
+ <x ng-repeat="(date, group) in g">
+ <div class="span12">
+ <h2>{{date | date:'mediumDate'}}</h2>
+ </div>
+ <div class="span12">
+ <div class="awarded-badge pull-left" ng-repeat="badge in group">
+ <div><person-avatar person="badge.person"></person-avatar></div>
- <badge-span badge="badge.badge" ></badge-span> <br/>
- <!--was awarded to<br/>-->
+ <badge-span badge="badge.badge" ></badge-span> <br/>
+ <!--was awarded to<br/>-->
+ </div>
</div>
- </div>
+ </x>
</div>
<ul class="pager">
<li class="previous" ng-show="persons.startIndex > 0">
diff --git a/src/main/resources/webapp/apps/frontPageApp/frontPageApp.js b/src/main/resources/webapp/apps/frontPageApp/frontPageApp.js
index 518fbbc..e16d96e 100755
--- a/src/main/resources/webapp/apps/frontPageApp/frontPageApp.js
+++ b/src/main/resources/webapp/apps/frontPageApp/frontPageApp.js
@@ -7,7 +7,8 @@ var frontPageApp = angular.module('frontPageApp', ['ngGrid', 'person', 'badge',
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});
+ when('/build/', {controller: BuildListCtrl, templateUrl: '/apps/frontPageApp/buildList.html?noCache=' + noCache}).
+ when('/build/:buildUuid', {controller: BuildCtrl, templateUrl: '/apps/frontPageApp/build.html?noCache=' + noCache});
});
function FrontPageCtrl($scope, Person, Badge) {
@@ -33,8 +34,6 @@ function groupBy(array, size) {
}
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();
@@ -43,16 +42,22 @@ function BadgeListCtrl($scope, Badge, PagingTableService) {
});
var byDay = _.groupBy(withDay, 'day');
- console.log("byDay", byDay);
-// var dateGroups = _.map(byDay, function(group, date) {
-// return {date: groupBy(group, groupSize)}
-// });
+// console.log("byDay", byDay);
+
+ byDay = _.map(byDay, function(value, key) {
+ var o = {};
+ o[key] = value;
+ return o;
+ });
+
+// byDay = _.toArray(byDay).reverse();
+// console.log("byDay", byDay);
$scope.badgeGroups = byDay;
};
- $scope.badges = PagingTableService.create($scope, PagingTableService.defaultCallback(Badge),
- {count: groupSize * 6, watcher: personsWatcher});
+ $scope.badges = PagingTableService.create($scope, PagingTableService.defaultCallback(Badge, {orderBy: "created_date-"}),
+ {count: 20, watcher: personsWatcher});
$scope.badgeGroups = [];
}
@@ -106,5 +111,13 @@ function PersonCtrl($scope, $routeParams, Person, Build, PagingTableService) {
}
function BuildListCtrl($scope, Build, PagingTableService) {
- $scope.builds = PagingTableService.create($scope, PagingTableService.defaultCallback(Build, {fields: "detailed"}));
+ $scope.builds = PagingTableService.create($scope, PagingTableService.defaultCallback(Build, {fields: "detailed"}));
+}
+
+function BuildCtrl($scope, Build, PagingTableService) {
+ var buildUuid = $routeParams.buildUuid;
+
+ Build.get({uuid: buildUuid}, function (build) {
+ $scope.build = build;
+ });
}
diff --git a/src/main/resources/webapp/apps/frontPageApp/person.html b/src/main/resources/webapp/apps/frontPageApp/person.html
index cec5738..a2e522d 100755
--- a/src/main/resources/webapp/apps/frontPageApp/person.html
+++ b/src/main/resources/webapp/apps/frontPageApp/person.html
@@ -77,7 +77,7 @@
</tbody>
<tfoot>
<tr>
- <td colspan="2">
+ <td colspan="3">
<ul class="pager">
<li class="previous" ng-class="{disabled: builds.startIndex == 0}">
<a ng-click="builds.prev()">&larr; Older</a>