Patchwork [3,of,3] gitweb: plug followlines UI in filerevision view

login
register
mail settings
Submitter Denis Laxalde
Date April 13, 2017, 9:05 a.m.
Message ID <47f250d6b023897eb99f.1492074321@sh77.tls.logilab.fr>
Download mbox | patch
Permalink /patch/20159/
State Accepted
Headers show

Comments

Denis Laxalde - April 13, 2017, 9:05 a.m.
# HG changeset patch
# User Denis Laxalde <denis.laxalde@logilab.fr>
# Date 1492069788 -7200
#      Thu Apr 13 09:49:48 2017 +0200
# Node ID 47f250d6b023897eb99f9892f9b379b3187b1c84
# Parent  c2e6e944113633a3051c78e773d2b09656a80718
# Available At http://hg.logilab.org/users/dlaxalde/hg
#              hg pull http://hg.logilab.org/users/dlaxalde/hg -r 47f250d6b023
# EXP-Topic followlines/gitweb
gitweb: plug followlines UI in filerevision view

Mostly copy CSS rules from style-paper.css into style-gitweb.css. The only
modification is addition of !important on "background-color" rule for
"pre.sourcelines > span.followlines-selected" selector as the background color
is otherwise overriden by "pre.sourcelines.stripes > :nth-child(4n+4)" rule.
Augie Fackler - April 13, 2017, 1:57 p.m.
On Thu, Apr 13, 2017 at 11:05:21AM +0200, Denis Laxalde wrote:
> # HG changeset patch
> # User Denis Laxalde <denis.laxalde@logilab.fr>
> # Date 1492069788 -7200
> #      Thu Apr 13 09:49:48 2017 +0200
> # Node ID 47f250d6b023897eb99f9892f9b379b3187b1c84
> # Parent  c2e6e944113633a3051c78e773d2b09656a80718
> # Available At http://hg.logilab.org/users/dlaxalde/hg
> #              hg pull http://hg.logilab.org/users/dlaxalde/hg -r 47f250d6b023
> # EXP-Topic followlines/gitweb
> gitweb: plug followlines UI in filerevision view

queued these, thanks

Patch

diff --git a/mercurial/templates/gitweb/filerevision.tmpl b/mercurial/templates/gitweb/filerevision.tmpl
--- a/mercurial/templates/gitweb/filerevision.tmpl
+++ b/mercurial/templates/gitweb/filerevision.tmpl
@@ -64,7 +64,9 @@  file |
 </div>
 
 <div class="page_body">
-<pre class="sourcelines stripes">{text%fileline}</pre>
+<pre class="sourcelines stripes" data-logurl="{url|urlescape}log/{symrev}/{file|urlescape}">{text%fileline}</pre>
 </div>
 
+<script type="text/javascript" src="{staticurl|urlescape}followlines.js"></script>
+
 {footer}
diff --git a/mercurial/templates/static/style-gitweb.css b/mercurial/templates/static/style-gitweb.css
--- a/mercurial/templates/static/style-gitweb.css
+++ b/mercurial/templates/static/style-gitweb.css
@@ -149,6 +149,62 @@  pre.sourcelines.stripes > span:target {
     font-family: monospace;
 }
 
+/* Followlines */
+div.page_body pre.sourcelines > span.followlines-select:hover {
+  cursor: cell;
+}
+
+pre.sourcelines > span.followlines-selected {
+  background-color: #99C7E9 !important;
+}
+
+div#followlines {
+  background-color: #B7B7B7;
+  border: 1px solid #CCC;
+  border-radius: 5px;
+  padding: 4px;
+  position: fixed;
+}
+
+div.followlines-cancel {
+  text-align: right;
+}
+
+div.followlines-cancel > button {
+  line-height: 80%;
+  padding: 0;
+  border: 0;
+  border-radius: 2px;
+  background-color: inherit;
+  font-weight: bold;
+}
+
+div.followlines-cancel > button:hover {
+  color: #FFFFFF;
+  background-color: #CF1F1F;
+}
+
+div.followlines-link {
+  margin: 2px;
+  margin-top: 4px;
+  font-family: sans-serif;
+}
+
+div#followlines-tooltip {
+  display: none;
+  position: fixed;
+  background-color: #ffc;
+  border: 1px solid #999;
+  padding: 2px;
+}
+
+.sourcelines:hover > div#followlines-tooltip {
+  display: inline;
+}
+
+.sourcelines:hover > div#followlines-tooltip.hidden {
+  display: none;
+}
 /* Graph */
 div#wrapper {
 	position: relative;
diff --git a/tests/test-hgweb.t b/tests/test-hgweb.t
--- a/tests/test-hgweb.t
+++ b/tests/test-hgweb.t
@@ -337,7 +337,7 @@  static file
 
   $ get-with-headers.py --twice localhost:$HGPORT 'static/style-gitweb.css' - date etag server
   200 Script output follows
-  content-length: 7032
+  content-length: 8012
   content-type: text/css
   
   body { font-family: sans-serif; font-size: 12px; border:solid #d9d8d1; border-width:1px; margin:10px; background: white; color: black; }
@@ -491,6 +491,62 @@  static file
       font-family: monospace;
   }
   
+  /* Followlines */
+  div.page_body pre.sourcelines > span.followlines-select:hover {
+    cursor: cell;
+  }
+  
+  pre.sourcelines > span.followlines-selected {
+    background-color: #99C7E9 !important;
+  }
+  
+  div#followlines {
+    background-color: #B7B7B7;
+    border: 1px solid #CCC;
+    border-radius: 5px;
+    padding: 4px;
+    position: fixed;
+  }
+  
+  div.followlines-cancel {
+    text-align: right;
+  }
+  
+  div.followlines-cancel > button {
+    line-height: 80%;
+    padding: 0;
+    border: 0;
+    border-radius: 2px;
+    background-color: inherit;
+    font-weight: bold;
+  }
+  
+  div.followlines-cancel > button:hover {
+    color: #FFFFFF;
+    background-color: #CF1F1F;
+  }
+  
+  div.followlines-link {
+    margin: 2px;
+    margin-top: 4px;
+    font-family: sans-serif;
+  }
+  
+  div#followlines-tooltip {
+    display: none;
+    position: fixed;
+    background-color: #ffc;
+    border: 1px solid #999;
+    padding: 2px;
+  }
+  
+  .sourcelines:hover > div#followlines-tooltip {
+    display: inline;
+  }
+  
+  .sourcelines:hover > div#followlines-tooltip.hidden {
+    display: none;
+  }
   /* Graph */
   div#wrapper {
   	position: relative;