[PATCH] comments: remove dysfunctional comment bubble on compare and file views (issue #84)

Thomas De Schampheleire patrickdepinguin at gmail.com
Thu Jun 11 04:59:38 EDT 2015


# HG changeset patch
# User Thomas De Schampheleire <thomas.de_schampheleire at alcatel-lucent.com>
# Date 1432734170 -7200
#      Wed May 27 15:42:50 2015 +0200
# Node ID d63188974baec38503601ef0efd33a75711280a2
# Parent  53d68f201e4602d3f2ccfcd27107d2ebea2deea2
comments: remove dysfunctional comment bubble on compare and file views (issue #84)

Several compare and file views would show a comment bubble when hovering code
lines, even though clicking on this bubble would not do anything.

Instead, make sure that the bubble only appears on pages that attach a click
action to the bubble (pullrequest and changeset pages), by splitting the
add-bubble CSS class in add-bubble (enabled when needed) and
add-bubble-placeholder (always present).

This change is inspired by code from Wouter Vermeiren.

diff --git a/kallithea/lib/diffs.py b/kallithea/lib/diffs.py
--- a/kallithea/lib/diffs.py
+++ b/kallithea/lib/diffs.py
@@ -737,7 +737,7 @@ class DiffProcessor(object):
                         'cc': code_class,
                         'inc': comments
                     })
-                    _html.append('''\n\t\t<div class="add-bubble"><div> </div></div><pre>%(code)s</pre>\n''' % {
+                    _html.append('''\n\t\t<div class="add-bubble-placeholder"><div> </div></div><pre>%(code)s</pre>\n''' % {
                         'code': change['line']
                     })
 
diff --git a/kallithea/public/css/style.css b/kallithea/public/css/style.css
--- a/kallithea/public/css/style.css
+++ b/kallithea/public/css/style.css
@@ -4996,7 +4996,7 @@ table.code-difftable .unmod .code pre:be
     width: 0;
 }
 
-.add-bubble {
+.add-bubble-placeholder {
     position: relative;
     display: none;
     float: left;
@@ -5008,9 +5008,9 @@ table.code-difftable .unmod .code pre:be
     box-sizing: border-box;
 }
 
-tr.line.add:hover td .add-bubble,
-tr.line.del:hover td .add-bubble,
-tr.line.unmod:hover td .add-bubble {
+tr.line.add:hover td .add-bubble-placeholder,
+tr.line.del:hover td .add-bubble-placeholder,
+tr.line.unmod:hover td .add-bubble-placeholder {
     display: block;
     z-index: 1;
 }
diff --git a/kallithea/templates/changeset/changeset.html b/kallithea/templates/changeset/changeset.html
--- a/kallithea/templates/changeset/changeset.html
+++ b/kallithea/templates/changeset/changeset.html
@@ -193,6 +193,7 @@
                   $('#{0} .inline-comments-button'.format(boxid)).hide();
               }
           });
+          $('.add-bubble-placeholder').addClass('add-bubble');
           $('.add-bubble').click(function(e){
               var tr = e.currentTarget;
               if(tr == null){
diff --git a/kallithea/templates/pullrequests/pullrequest_show.html b/kallithea/templates/pullrequests/pullrequest_show.html
--- a/kallithea/templates/pullrequests/pullrequest_show.html
+++ b/kallithea/templates/pullrequests/pullrequest_show.html
@@ -367,6 +367,7 @@
       $(document).ready(function(){
           PullRequestAutoComplete('user', 'reviewers_container', _USERS_AC_DATA, _GROUPS_AC_DATA);
 
+          $('.add-bubble-placeholder').addClass('add-bubble');
           $('.add-bubble').click(function(e){
               var tr = e.currentTarget;
               injectInlineForm(tr.parentNode.parentNode);


More information about the kallithea-general mailing list