changeset 5649:7db8e58cee2f

diffs: introduce 'show inline comments' control for pull-requests too Make diff_block_simple control inline comments like diff_block does. .show-inline-comments handling is moved to the generic diff handling js. I am not sure this is useful when the whole diff is sent to the client side anyway ... but for now, let's be consistent.
author Jan Heylen <heyleke@gmail.com>
date Sun, 29 Nov 2015 16:43:42 +0100
parents 62b350b577a9
children 76b9630e1e92
files kallithea/templates/changeset/changeset.html kallithea/templates/changeset/diff_block.html
diffstat 2 files changed, 18 insertions(+), 13 deletions(-) [+]
line wrap: on
line diff
--- a/kallithea/templates/changeset/changeset.html	Tue Jan 05 16:56:16 2016 +0100
+++ b/kallithea/templates/changeset/changeset.html	Sun Nov 29 16:43:42 2015 +0100
@@ -209,19 +209,6 @@
     ## FORM FOR MAKING JS ACTION AS CHANGESET COMMENTS
     <script type="text/javascript">
       $(document).ready(function(){
-          $('.show-inline-comments').change(function(e){
-              var target = e.currentTarget;
-              if(target == null){
-                  target = this;
-              }
-              var boxid = $(target).attr('id_for');
-              if(target.checked){
-                  $('#{0} .inline-comments'.format(boxid)).show();
-              }else{
-                  $('#{0} .inline-comments'.format(boxid)).hide();
-              }
-          });
-
           $('.code-difftable').on('click', '.add-bubble', function(e){
               show_comment_form($(this));
           });
--- a/kallithea/templates/changeset/diff_block.html	Tue Jan 05 16:56:16 2016 +0100
+++ b/kallithea/templates/changeset/diff_block.html	Sun Nov 29 16:43:42 2015 +0100
@@ -117,6 +117,12 @@
                   ${c.ignorews_url(request.GET, url_fid)}
                   ${c.context_url(request.GET, url_fid)}
                 </div>
+                <span style="float:right;margin-top:-3px">
+                    <label>
+                        ${_('Show inline comments')}
+                        ${h.checkbox('',checked="checked",class_="show-inline-comments",id_for=url_fid)}
+                    </label>
+                </span>
             </div>
         </div>
         <div class="code-body full_f_path" data-f_path="${h.safe_unicode(filename)}">
@@ -179,6 +185,18 @@
             $button.html("&darr; {0} &darr;".format(_TM['Expand Diff']));
         }
     });
+    $('.show-inline-comments').change(function(e){
+        var target = e.currentTarget;
+        if(target == null){
+            target = this;
+        }
+        var boxid = $(target).attr('id_for');
+        if(target.checked){
+            $('#{0} .inline-comments'.format(boxid)).show();
+        }else{
+            $('#{0} .inline-comments'.format(boxid)).hide();
+        }
+    });
 });
 </script>
 </%def>