diff mercurial/templates/static/followlines.js @ 31940:6ce09d2cc2db

hgweb: add a link to followlines in descending direction We change the content of the followlines popup to display two links inviting to follow the history of selected lines in ascending (as before) and descending directions. The popup now renders as: follow history of lines <fromline>:<toline>: <a href=...>ascending</a> / <a href=...>descending</a>
author Denis Laxalde <denis.laxalde@logilab.fr>
date Mon, 10 Apr 2017 17:36:40 +0200
parents 5c1abb4bd3ee
children a298f5c61b34
line wrap: on
line diff
--- a/mercurial/templates/static/followlines.js	Mon Apr 10 16:23:41 2017 +0200
+++ b/mercurial/templates/static/followlines.js	Mon Apr 10 17:36:40 2017 +0200
@@ -204,13 +204,23 @@
         //   <div class="followlines-link">
         var aDiv = document.createElement('div');
         aDiv.classList.add('followlines-link');
-
-        //     <a href="/log/<rev>/<file>?patch=&linerange=...">
-        var a = document.createElement('a');
+        aDiv.textContent = 'follow history of lines ' + fromline + ':' + toline + ':';
+        var linesep = document.createElement('br');
+        aDiv.appendChild(linesep);
+        //     link to "ascending" followlines
+        var aAsc = document.createElement('a');
         var url = targetUri + '?patch=&linerange=' + fromline + ':' + toline;
-        a.setAttribute('href', url);
-        a.textContent = 'follow lines ' + fromline + ':' + toline;
-        aDiv.appendChild(a);
+        aAsc.setAttribute('href', url);
+        aAsc.textContent = 'ascending';
+        aDiv.appendChild(aAsc);
+        var sep = document.createTextNode(' / ');
+        aDiv.appendChild(sep);
+        //     link to "descending" followlines
+        var aDesc = document.createElement('a');
+        aDesc.setAttribute('href', url + '&descend=');
+        aDesc.textContent = 'descending';
+        aDiv.appendChild(aDesc);
+
         div.appendChild(aDiv);
 
         return [div, button];