Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

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 authored September 22, 2009
12  modules/comment/js/comment.js
@@ -10,6 +10,18 @@ $("document").ready(function() {
10 10
 	    });
11 11
     }
12 12
   });
  13
+  $("#gNoComments").click(function(event) {
  14
+    event.preventDefault();
  15
+    if (!$("#gAddCommentForm").length) {
  16
+      $.get($(this).attr("href"),
  17
+	    {},
  18
+	    function(data) {
  19
+	      $("#gCommentDetail").append(data);
  20
+	      ajaxify_comment_form();
  21
+	    });
  22
+      $("#gNoCommentsYet").remove();
  23
+    }
  24
+  });
13 25
 });
14 26
 
15 27
 function ajaxify_comment_form() {
2  modules/comment/views/comments.html.php
@@ -8,7 +8,7 @@ class="gButtonLink ui-corner-all ui-icon-left ui-state-default right">
8 8
 <? if (!$comments->count()): ?>
9 9
 <p id="gNoCommentsYet">
10 10
   <?= t("No comments yet. Be the first to <a %attrs>comment</a>!",
11  
-        array("attrs" => html::mark_clean("href=\"#add_comment_form\" class=\"showCommentForm\""))) ?>
  11
+        array("attrs" => html::mark_clean("id= \"gNoComments\" href=\"" . url::site("form/add/comments/{$item->id}") . "\" class=\"showCommentForm\""))) ?>
12 12
 </p>
13 13
 <? endif ?>
14 14
 <ul>

0 notes on commit b310fab

Please sign in to comment.
Something went wrong with that request. Please try again.