From 21d6e17efafbbb249f13c0344abf2dad9a812103 Mon Sep 17 00:00:00 2001 From: Bharat Mediratta Date: Sun, 13 Sep 2009 14:19:04 -0700 Subject: Don't add another comment form every time you click the [Add a comment] button. --- modules/comment/js/comment.js | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) (limited to 'modules/comment') diff --git a/modules/comment/js/comment.js b/modules/comment/js/comment.js index 9fd63c1a..bff83770 100644 --- a/modules/comment/js/comment.js +++ b/modules/comment/js/comment.js @@ -1,13 +1,15 @@ $("document").ready(function() { $("#gAddCommentButton").click(function(event) { event.preventDefault(); - $.get($(this).attr("href"), - {}, - function(data) { - $("#gCommentDetail").append(data); - ajaxify_comment_form(); - }); - }); + if (!$("#gAddCommentForm").length) { + $.get($(this).attr("href"), + {}, + function(data) { + $("#gCommentDetail").append(data); + ajaxify_comment_form(); + }); + } + }); }); function ajaxify_comment_form() { @@ -22,7 +24,7 @@ function ajaxify_comment_form() { $.get(data.resource, function(data, textStatus) { $("#gComments .gBlockContent ul:first").append("
  • "+data+"
  • "); $("#gComments .gBlockContent ul:first li:last").effect("highlight", {color: "#cfc"}, 8000); - $("#gAddCommentForm").hide(2000); + $("#gAddCommentForm").hide(2000).remove(); $("#gNoCommentsYet").hide(2000); }); } -- cgit v1.2.3 From aed7ce916138ec31798bec9cbee66a8742670633 Mon Sep 17 00:00:00 2001 From: Bharat Mediratta Date: Sun, 13 Sep 2009 14:25:17 -0700 Subject: Specify a page anchor for the comments block. --- modules/comment/helpers/comment_theme.php | 1 + 1 file changed, 1 insertion(+) (limited to 'modules/comment') diff --git a/modules/comment/helpers/comment_theme.php b/modules/comment/helpers/comment_theme.php index 38a00b5c..e9b402f6 100644 --- a/modules/comment/helpers/comment_theme.php +++ b/modules/comment/helpers/comment_theme.php @@ -27,6 +27,7 @@ class comment_theme_Core { $block = new Block; $block->css_id = "gComments"; $block->title = t("Comments"); + $block->anchor = "comments"; $view = new View("comments.html"); $view->comments = ORM::factory("comment") -- cgit v1.2.3