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.

This commit is contained in:
Tim Almdal
2009-09-22 07:59:26 -07:00
parent 78cce555c3
commit b310fab1f8
2 changed files with 13 additions and 1 deletions

View File

@@ -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() {

View File

@@ -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>