From 097bb365454bb0471463fc610621deac63679884 Mon Sep 17 00:00:00 2001 From: =?utf8?q?David=20=E2=80=98Bombe=E2=80=99=20Roden?= Date: Mon, 18 Oct 2010 09:52:18 +0200 Subject: [PATCH] =?utf8?q?Hide=20reply=20creation=20input=20text=20fields?= =?utf8?q?=20until=20=E2=80=9Ccomment=E2=80=9D=20link=20is=20clicked.?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- src/main/resources/templates/include/viewPost.html | 4 ++-- src/main/resources/templates/index.html | 12 +++++++++--- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/src/main/resources/templates/include/viewPost.html b/src/main/resources/templates/include/viewPost.html index 00ee653..74fe29a 100644 --- a/src/main/resources/templates/include/viewPost.html +++ b/src/main/resources/templates/include/viewPost.html @@ -1,4 +1,4 @@ -
+
<% post.text|html>
@@ -20,7 +20,7 @@
<%/foreach> -
+
diff --git a/src/main/resources/templates/index.html b/src/main/resources/templates/index.html index 2b21e91..8cbf77e 100644 --- a/src/main/resources/templates/index.html +++ b/src/main/resources/templates/index.html @@ -7,10 +7,16 @@ registerInputTextareaSwap("#sone input.create-reply", "Write a Reply…"); /* hide all the “create reply” forms until a link is clicked. */ - commentElement = $("
Comment
").addClass("show-reply-form").click(function() { + $("#sone .post").each(function() { + postId = $(this).attr("id"); + (function(postId) { + commentElement = $("
Comment
").addClass("show-reply-form").click(function() { + $("#sone .post#" + postId + " .create-reply").removeClass("hidden"); + }); + })(postId); + $(this).find(".create-reply").addClass("hidden"); + $(this).find(".status-line .time").after(commentElement); }); - $("#sone .post > .status-line .time").after(commentElement); - $("#sone .post .create-reply").addClass("hidden"); }); -- 2.7.4