From c80d8668e387886c7fbda86e4196f65ba2e3a49c Mon Sep 17 00:00:00 2001 From: =?utf8?q?David=20=E2=80=98Bombe=E2=80=99=20Roden?= Date: Sat, 23 Oct 2010 12:43:15 +0200 Subject: [PATCH] Hide 0 likes. --- src/main/java/net/pterodactylus/sone/web/WebInterface.java | 2 ++ src/main/resources/static/css/sone.css | 4 ++++ src/main/resources/static/javascript/sone.js | 1 + src/main/resources/templates/include/viewPost.html | 2 +- 4 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/main/java/net/pterodactylus/sone/web/WebInterface.java b/src/main/java/net/pterodactylus/sone/web/WebInterface.java index bd640bc..bb7f740 100644 --- a/src/main/java/net/pterodactylus/sone/web/WebInterface.java +++ b/src/main/java/net/pterodactylus/sone/web/WebInterface.java @@ -56,6 +56,7 @@ import net.pterodactylus.util.logging.Logging; import net.pterodactylus.util.service.AbstractService; import net.pterodactylus.util.template.DateFilter; import net.pterodactylus.util.template.DefaultTemplateFactory; +import net.pterodactylus.util.template.MatchFilter; import net.pterodactylus.util.template.PaginationPlugin; import net.pterodactylus.util.template.ReflectionAccessor; import net.pterodactylus.util.template.Template; @@ -181,6 +182,7 @@ public class WebInterface extends AbstractService { templateFactory.addFilter("substring", new SubstringFilter()); templateFactory.addFilter("xml", new XmlFilter()); templateFactory.addFilter("change", new RequestChangeFilter()); + templateFactory.addFilter("match", new MatchFilter()); templateFactory.addPlugin("getpage", new GetPagePlugin()); templateFactory.addPlugin("paginate", new PaginationPlugin()); templateFactory.setTemplateProvider(new ClassPathTemplateProvider(templateFactory)); diff --git a/src/main/resources/static/css/sone.css b/src/main/resources/static/css/sone.css index f6628ce..cbf69a6 100644 --- a/src/main/resources/static/css/sone.css +++ b/src/main/resources/static/css/sone.css @@ -148,6 +148,10 @@ textarea { font: inherit; } +#sone .post .likes.hidden { + display: none; +} + #sone .post .like.hidden, #sone .post .unlike.hidden { display: none; } diff --git a/src/main/resources/static/javascript/sone.js b/src/main/resources/static/javascript/sone.js index 9bb379c..be7deaa 100644 --- a/src/main/resources/static/javascript/sone.js +++ b/src/main/resources/static/javascript/sone.js @@ -286,6 +286,7 @@ function unlikePost(postId) { function updatePostLikes(postId) { $.getJSON("ajax/getPostLikes.ajax", { "post": postId }, function(data, textStatus) { if (data.success) { + $("#sone .post#" + postId + " > .status-line .likes").toggleClass("hidden", data.likes == 0) $("#sone .post#" + postId + " > .status-line .likes span.like-count").text(data.likes); } }); diff --git a/src/main/resources/templates/include/viewPost.html b/src/main/resources/templates/include/viewPost.html index c3ad07a..991ccec 100644 --- a/src/main/resources/templates/include/viewPost.html +++ b/src/main/resources/templates/include/viewPost.html @@ -5,7 +5,7 @@
- +
⬆
<%ifnull ! currentSone>
-- 2.7.4