diff options
author | Tim Almdal <tnalmdal@shaw.ca> | 2009-09-22 07:59:26 -0700 |
---|---|---|
committer | Tim Almdal <tnalmdal@shaw.ca> | 2009-09-22 07:59:26 -0700 |
commit | b310fab1f8e88371e4f2f1fa41173e1fc5eddb60 (patch) | |
tree | 120fdd8a15b965326adb6c36e5425117485746d5 | |
parent | 78cce555c377b4dd3078a007c6c407cf4eb9f6dd (diff) |
Change the link on the "Be first to comment" link to do a request to the server to get the comment add form. Fixes ticket #699.
-rw-r--r-- | modules/comment/js/comment.js | 12 | ||||
-rw-r--r-- | modules/comment/views/comments.html.php | 2 |
2 files changed, 13 insertions, 1 deletions
diff --git a/modules/comment/js/comment.js b/modules/comment/js/comment.js index bff83770..6e985626 100644 --- a/modules/comment/js/comment.js +++ b/modules/comment/js/comment.js @@ -10,6 +10,18 @@ $("document").ready(function() { }); } }); + $("#gNoComments").click(function(event) { + event.preventDefault(); + if (!$("#gAddCommentForm").length) { + $.get($(this).attr("href"), + {}, + function(data) { + $("#gCommentDetail").append(data); + ajaxify_comment_form(); + }); + $("#gNoCommentsYet").remove(); + } + }); }); function ajaxify_comment_form() { diff --git a/modules/comment/views/comments.html.php b/modules/comment/views/comments.html.php index 7eb34c20..dd706a23 100644 --- a/modules/comment/views/comments.html.php +++ b/modules/comment/views/comments.html.php @@ -8,7 +8,7 @@ <? if (!$comments->count()): ?> <p id="gNoCommentsYet"> <?= t("No comments yet. Be the first to <a %attrs>comment</a>!", - array("attrs" => html::mark_clean("href=\"#add_comment_form\" class=\"showCommentForm\""))) ?> + array("attrs" => html::mark_clean("id= \"gNoComments\" href=\"" . url::site("form/add/comments/{$item->id}") . "\" class=\"showCommentForm\""))) ?> </p> <? endif ?> <ul> |