From: David ‘Bombe’ Roden Date: Fri, 30 Sep 2011 12:57:37 +0000 (+0200) Subject: Add “sort by image count” for Known Sones. X-Git-Tag: 0.7.2^2~6 X-Git-Url: https://git.pterodactylus.net/?a=commitdiff_plain;h=0ce0d62894739d3769490d9fde6fa98561b3dfae;p=Sone.git Add “sort by image count” for Known Sones. --- 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 @@ +