From: David ‘Bombe’ Roden Date: Sat, 23 Oct 2010 10:43:15 +0000 (+0200) Subject: Hide 0 likes. X-Git-Tag: 0.1-RC1~67 X-Git-Url: https://git.pterodactylus.net/?a=commitdiff_plain;h=c80d8668e387886c7fbda86e4196f65ba2e3a49c;p=Sone.git Hide 0 likes. --- 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>