Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

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.
  • Loading branch information...
commit b310fab1f8e88371e4f2f1fa41173e1fc5eddb60 1 parent 78cce55
Tim Almdal talmdal authored
12 modules/comment/js/comment.js
View
@@ -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() {
2  modules/comment/views/comments.html.php
View
@@ -8,7 +8,7 @@ class="gButtonLink ui-corner-all ui-icon-left ui-state-default right">
<? 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>
Please sign in to comment.
Something went wrong with that request. Please try again.