monoblue: don't show '[up]' in file view when in root directory already
authorAnton Shestakov <av6@dwimlabs.net>
Thu, 31 May 2018 18:39:35 +0800
changeset 38217 9ed3527019b5
parent 38216 d6aa1fc8292f
child 38218 273ce823ba5c
monoblue: don't show '[up]' in file view when in root directory already
mercurial/templates/monoblue/manifest.tmpl
mercurial/templates/monoblue/map
tests/test-hgweb-descend-empties.t
tests/test-hgweb-symrev.t
tests/test-hgweb.t
--- a/mercurial/templates/monoblue/manifest.tmpl	Thu May 31 18:33:49 2018 +0800
+++ b/mercurial/templates/monoblue/manifest.tmpl	Thu May 31 18:39:35 2018 +0800
@@ -33,13 +33,7 @@
     <p class="files">{path|escape} {alltags}</p>
 
     <table>
-        <tr class="parity{upparity}">
-            <td>drwxr-xr-x</td>
-            <td></td>
-            <td></td>
-            <td><a href="{url|urlescape}file/{symrev}{up|urlescape}{sessionvars%urlparameter}">[up]</a></td>
-            <td class="link">&nbsp;</td>
-        </tr>
+        {ifeq(path, up, '', updirentry)}
         {dentries%direntry}
         {fentries%fileentry}
     </table>
--- a/mercurial/templates/monoblue/map	Thu May 31 18:33:49 2018 +0800
+++ b/mercurial/templates/monoblue/map	Thu May 31 18:39:35 2018 +0800
@@ -59,6 +59,16 @@
 changelogentry = changelogentry.tmpl
 changeset = changeset.tmpl
 manifest = manifest.tmpl
+updirentry = '
+  <tr class="parity{upparity}">
+    <td>drwxr-xr-x</td>
+    <td></td>
+    <td></td>
+    <td>
+      <a href="{url|urlescape}file/{symrev}{up|urlescape}{sessionvars%urlparameter}">[up]</a>
+    </td>
+    <td class="link">&nbsp;</td>
+  </tr>'
 direntry = '
   <tr class="parity{parity}">
     <td>drwxr-xr-x</td>
--- a/tests/test-hgweb-descend-empties.t	Thu May 31 18:33:49 2018 +0800
+++ b/tests/test-hgweb-descend-empties.t	Thu May 31 18:39:35 2018 +0800
@@ -312,13 +312,7 @@
       <p class="files">/ <span class="logtags"><span class="phasetag" title="draft">draft</span> <span class="branchtag" title="default">default</span> <span class="tagtag" title="tip">tip</span> </span></p>
   
       <table>
-          <tr class="parity0">
-              <td>drwxr-xr-x</td>
-              <td></td>
-              <td></td>
-              <td><a href="/file/tip/?style=monoblue">[up]</a></td>
-              <td class="link">&nbsp;</td>
-          </tr>
+          
           
   <tr class="parity1">
   <td>drwxr-xr-x</td>
--- a/tests/test-hgweb-symrev.t	Thu May 31 18:33:49 2018 +0800
+++ b/tests/test-hgweb-symrev.t	Thu May 31 18:39:35 2018 +0800
@@ -754,7 +754,6 @@
               <li><a href="/graph/tip?style=monoblue">graph</a></li>
           <li><a href="/rev/tip?style=monoblue">changeset</a></li>
           <li><a href="/archive/tip.zip">zip</a></li>
-              <td><a href="/file/tip/?style=monoblue">[up]</a></td>
   <a href="/file/tip/dir?style=monoblue">dir</a>
   <a href="/file/tip/dir/?style=monoblue"></a>
   <td><a href="/file/tip/dir?style=monoblue">files</a></td>
@@ -817,7 +816,6 @@
               <li><a href="/graph/xyzzy?style=monoblue">graph</a></li>
           <li><a href="/rev/xyzzy?style=monoblue">changeset</a></li>
           <li><a href="/archive/xyzzy.zip">zip</a></li>
-              <td><a href="/file/xyzzy/?style=monoblue">[up]</a></td>
   <a href="/file/xyzzy/dir?style=monoblue">dir</a>
   <a href="/file/xyzzy/dir/?style=monoblue"></a>
   <td><a href="/file/xyzzy/dir?style=monoblue">files</a></td>
--- a/tests/test-hgweb.t	Thu May 31 18:33:49 2018 +0800
+++ b/tests/test-hgweb.t	Thu May 31 18:39:35 2018 +0800
@@ -812,6 +812,10 @@
   [1]
   $ get-with-headers.py localhost:$HGPORT 'file/tip/da?style=gitweb' | grep -F '[up]'
   <a href="/file/tip/?style=gitweb">[up]</a>
+  $ get-with-headers.py localhost:$HGPORT 'file/tip?style=monoblue' | grep -F '[up]'
+  [1]
+  $ get-with-headers.py localhost:$HGPORT 'file/tip/da?style=monoblue' | grep -F '[up]'
+  <a href="/file/tip/?style=monoblue">[up]</a>
 
 no style can be loaded from directories other than the specified paths