changeset 4386:5f883a5be2d1

comments: show icon to the left of the code, only visible and clickable when hovering the code
author Mads Kiilerich <madski@unity3d.com>
date Fri, 18 Jul 2014 19:22:01 +0200
parents a21668fe545b
children e271a8766951
files kallithea/lib/diffs.py kallithea/public/css/style.css kallithea/templates/changeset/changeset.html kallithea/templates/pullrequests/pullrequest_show.html
diffstat 4 files changed, 27 insertions(+), 18 deletions(-) [+]
line wrap: on
line diff
--- a/kallithea/lib/diffs.py	Fri Jul 18 19:22:01 2014 +0200
+++ b/kallithea/lib/diffs.py	Fri Jul 18 19:22:01 2014 +0200
@@ -720,7 +720,7 @@
                         'cc': code_class,
                         'inc': comments
                     })
-                    _html.append('''\n\t\t<pre>%(code)s</pre>\n''' % {
+                    _html.append('''\n\t\t<div class="add-bubble"><div>&nbsp;</div></div><pre>%(code)s</pre>\n''' % {
                         'code': change['line']
                     })
 
--- a/kallithea/public/css/style.css	Fri Jul 18 19:22:01 2014 +0200
+++ b/kallithea/public/css/style.css	Fri Jul 18 19:22:01 2014 +0200
@@ -4915,6 +4915,7 @@
 }
 div.diffblock.margined {
     margin: 0px 20px 0px 20px;
+    overflow: hidden;
 }
 div.diffblock .code-header {
     border-bottom: 1px solid #CCCCCC;
@@ -5085,19 +5086,27 @@
     line-height: 17px;
 }
 
-
-.diffblock.margined.comm .line .code:hover {
-    background-color: #FFFFCC !important;
-    cursor: pointer !important;
-    background-image: url("../images/icons/comment_add.png") !important;
-    background-repeat: no-repeat !important;
-    background-position: right !important;
-    background-position: 0% 50% !important;
-}
-.diffblock.margined.comm .line .code.no-comment:hover {
-    background-image: none !important;
-    cursor: auto !important;
-    background-color: inherit !important;
+.add-bubble {
+    display: none;
+    float: left;
+    width: 0px;
+    height: 0px;
+}
+
+tr.line.add td.code:hover .add-bubble,
+tr.line.del td.code:hover .add-bubble,
+tr.line.unmod td.code:hover .add-bubble {
+    display: inherit;
+}
+
+.add-bubble div {
+    position: relative;
+    left: -32px;
+    width: 32px;
+    top: -8px;
+    height: 32px;
+    background: url("../images/icons/comment_add.png") no-repeat 100% 50%;
+    cursor: pointer;
 }
 
 div.comment:target>.comment-wrapp {
--- a/kallithea/templates/changeset/changeset.html	Fri Jul 18 19:22:01 2014 +0200
+++ b/kallithea/templates/changeset/changeset.html	Fri Jul 18 19:22:01 2014 +0200
@@ -197,12 +197,12 @@
                }
           })
 
-          YUE.on(YUQ('.line'),'click',function(e){
+          YUE.on(YUQ('.add-bubble'),'click',function(e){
               var tr = e.currentTarget;
               if(tr == null){
                   tr = this;
               }
-              injectInlineForm(tr);
+              injectInlineForm(tr.parentNode.parentNode);
           });
 
           // inject comments into they proper positions
--- a/kallithea/templates/pullrequests/pullrequest_show.html	Fri Jul 18 19:22:01 2014 +0200
+++ b/kallithea/templates/pullrequests/pullrequest_show.html	Fri Jul 18 19:22:01 2014 +0200
@@ -350,9 +350,9 @@
                }
           })
 
-          YUE.on(YUQ('.line'),'click',function(e){
+          YUE.on(YUQ('.add-bubble'),'click',function(e){
               var tr = e.currentTarget;
-              injectInlineForm(tr);
+              injectInlineForm(tr.parentNode.parentNode);
           });
 
           // inject comments into they proper positions