]> git.ipfire.org Git - thirdparty/bugzilla.git/commitdiff
Bug 574338: When comment box is positioned at [top|bottom], include "Add Comment...
authorGuy Pyrzak <guy.pyrzak@gmail.com>
Sat, 18 Sep 2010 23:22:46 +0000 (01:22 +0200)
committerFrédéric Buclin <LpSolit@gmail.com>
Sat, 18 Sep 2010 23:22:46 +0000 (01:22 +0200)
r/a=mkanat

js/comments.js
template/en/default/bug/comments.html.tmpl

index 79bdae855fcc8904b09fd66f43bce023ae095598..697cedd20e9cb5fafb0f8a97e16983a7e1c064d8 100644 (file)
@@ -86,3 +86,14 @@ function addCollapseLink(count) {
                    '); return false;" title="Collapse the comment.">[-]<\/a> ');
 }
 
+function goto_add_comments( anchor ){
+    anchor =  (anchor || "add_comment");
+    // we need this line to expand the comment box
+    document.getElementById('comment').focus();
+    setTimeout(function(){ 
+        document.location.hash = anchor;
+        // firefox doesn't seem to keep focus through the anchor change
+        document.getElementById('comment').focus();
+    },10);
+    return false;
+}
index e44e4e7b95f8af7acb17bc60fa35f51acded30d6..9a7a050afedc78a7efe3303fbedfe5d7e2111ec9 100644 (file)
   [% count = count + increment %]
 [% END %]
 
+[% IF user.settings.comment_box_position.value == "before_comments" && user.id %]
+  <div class="bz_add_comment">
+    <a href="#" 
+       onclick="return goto_add_comments();">
+       Add Comment</a>
+  </div>
+[% END %]
+
 [%# Note: this template is used in multiple places; if you use this hook,
   # make sure you are aware of this fact.
   #%]  
                                return false;">Collapse All Comments</a></li>
       <li><a href="#" onclick="toggle_all_comments('expand', [% comments.size %]);
                                return false;">Expand All Comments</a></li>
+      [% IF user.settings.comment_box_position.value == "after_comments" && user.id %]
+        <li class="bz_add_comment"><a href="#" 
+            onclick="return goto_add_comments('bug_status_bottom');">
+            Add Comment</a></li>
+      [% END %]                               
     </ul>
   [% END %]
 </td>