From 0ce0d62894739d3769490d9fde6fa98561b3dfae Mon Sep 17 00:00:00 2001 From: =?utf8?q?David=20=E2=80=98Bombe=E2=80=99=20Roden?= Date: Fri, 30 Sep 2011 14:57:37 +0200 Subject: [PATCH] =?utf8?q?Add=20=E2=80=9Csort=20by=20image=20count?= =?utf8?q?=E2=80=9D=20for=20Known=20Sones.?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- src/main/java/net/pterodactylus/sone/web/KnownSonesPage.java | 6 ++++++ src/main/resources/templates/knownSones.html | 3 ++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/main/java/net/pterodactylus/sone/web/KnownSonesPage.java b/src/main/java/net/pterodactylus/sone/web/KnownSonesPage.java index e5acad5..0e27265 100644 --- a/src/main/java/net/pterodactylus/sone/web/KnownSonesPage.java +++ b/src/main/java/net/pterodactylus/sone/web/KnownSonesPage.java @@ -97,6 +97,12 @@ public class KnownSonesPage extends SoneTemplatePage { } else { Collections.sort(knownSones, Sone.POST_COUNT_COMPARATOR); } + } else if ("images".equals(sortField)) { + if ("asc".equals(sortOrder)) { + Collections.sort(knownSones, new ReverseComparator(Sone.IMAGE_COUNT_COMPARATOR)); + } else { + Collections.sort(knownSones, Sone.IMAGE_COUNT_COMPARATOR); + } } else { if ("desc".equals(sortOrder)) { Collections.sort(knownSones, new ReverseComparator(Sone.NICE_NAME_COMPARATOR)); diff --git a/src/main/resources/templates/knownSones.html b/src/main/resources/templates/knownSones.html index 260a321..72bc80a 100644 --- a/src/main/resources/templates/knownSones.html +++ b/src/main/resources/templates/knownSones.html @@ -7,7 +7,7 @@ $(document).ready(function() { $("select[name=sort]").change(function() { value = $(this).val(); - if ((value == "activity") || (value == "posts")) { + if ((value == "activity") || (value == "posts") || (value == "images")) { $("select[name=order]").val("desc"); } else if (value == "name") { $("select[name=order]").val("asc"); @@ -30,6 +30,7 @@ +