From c2a5677a46f91696ec7748d7d1202fe5d5f685f7 Mon Sep 17 00:00:00 2001 From: Trygve Laugstøl Date: Sat, 12 Jan 2013 14:19:19 +0100 Subject: o Sorting the badge list with newest first. --- src/main/java/io/trygvis/esper/testing/Util.java | 24 +++++++++------- .../trygvis/esper/testing/core/db/PersonDao.java | 3 +- .../webapp/apps/frontPageApp/badgeList.html | 22 ++++++++------- .../webapp/apps/frontPageApp/frontPageApp.js | 33 +++++++++++++++------- .../resources/webapp/apps/frontPageApp/person.html | 2 +- 5 files changed, 52 insertions(+), 32 deletions(-) (limited to 'src/main') 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 @@
-
-
-

{{date | date:'mediumDate'}}

-
-
-
-
+
+ +
+

{{date | date:'mediumDate'}}

+
+
+
+
-
- +
+ +
-
+