hgweb: use css for stripey background in coal
authorAnton Shestakov <av6@dwimlabs.net>
Thu, 25 Jun 2015 20:27:36 +0800
changeset 25664 ebdfca23c1ab
parent 25663 edd2d20ac687
child 25666 1c7e62360068
hgweb: use css for stripey background in coal Since "b8ecc3830c89 or 25dae11bb044::c229a5e7511e" paper style used css for stripes in background for browsing files, for listing branches/tags/bookmarks, and so on. Since coal borrows many paper templates (e.g. shortlogentry.tmpl), it actually tried to do the same, but it didn't have the needed css classes. You can compare https://selenic.com/hg?style=coal with https://selenic.com/hg?style=paper and see how log view in coal style has plain white background, unlike the one in paper style. This wasn't intended. Let's copy css classes directly from style-paper.css and remove parity classes from elements that don't need them anymore. This makes plain white background have stripes again and makes coal/map even more similar to paper/map (which can ease porting changes or %including paper/map in future).
mercurial/templates/coal/map
mercurial/templates/static/style-coal.css
tests/test-hgweb-descend-empties.t
--- a/mercurial/templates/coal/map	Wed Jun 24 11:15:00 2015 -0400
+++ b/mercurial/templates/coal/map	Thu Jun 25 20:27:36 2015 +0800
@@ -43,7 +43,7 @@
 filenav = '{before%filenaventry}{after%filenaventry}'
 
 direntry = '
-  <tr class="fileline parity{parity}">
+  <tr class="fileline">
     <td class="name">
       <a href="{url|urlescape}file/{symrev}{path|urlescape}{sessionvars%urlparameter}">
         <img src="{staticurl|urlescape}coal-folder.png" alt="dir."/> {basename|escape}/
@@ -57,7 +57,7 @@
   </tr>'
 
 fileentry = '
-  <tr class="fileline parity{parity}">
+  <tr class="fileline">
     <td class="filename">
       <a href="{url|urlescape}file/{symrev}/{file|urlescape}{sessionvars%urlparameter}">
         <img src="{staticurl|urlescape}coal-file.png" alt="file"/> {basename|escape}
@@ -73,11 +73,11 @@
 filecomparison = ../paper/filecomparison.tmpl
 filelog = ../paper/filelog.tmpl
 fileline = '
-  <div class="parity{parity} source"><a href="#{lineid}" id="{lineid}">{linenumber}</a> {line|escape}</div>'
+  <div class="source"><a href="#{lineid}" id="{lineid}">{linenumber}</a> {line|escape}</div>'
 filelogentry = ../paper/filelogentry.tmpl
 
 annotateline = '
-  <tr class="parity{parity}">
+  <tr>
     <td class="annotate">
       <a href="{url|urlescape}annotate/{node|short}/{file|urlescape}{sessionvars%urlparameter}#{targetline}"
          title="{node|short}: {desc|escape|firstline}">{author|user}@{rev}</a>
@@ -85,7 +85,7 @@
     <td class="source"><a href="#{lineid}" id="{lineid}">{linenumber}</a> {line|escape}</td>
   </tr>'
 
-diffblock = '<div class="source bottomline parity{parity}"><pre>{lines}</pre></div>'
+diffblock = '<div class="source bottomline"><pre>{lines}</pre></div>'
 difflineplus = '<a href="#{lineid}" id="{lineid}">{linenumber}</a> <span class="plusline">{line|escape}</span>'
 difflineminus = '<a href="#{lineid}" id="{lineid}">{linenumber}</a> <span class="minusline">{line|escape}</span>'
 difflineat = '<a href="#{lineid}" id="{lineid}">{linenumber}</a> <span class="atline">{line|escape}</span>'
@@ -156,7 +156,7 @@
   </tr>'
 tags = ../paper/tags.tmpl
 tagentry = '
-  <tr class="tagEntry parity{parity}">
+  <tr class="tagEntry">
     <td>
       <a href="{url|urlescape}rev/{node|short}{sessionvars%urlparameter}">
         {tag|escape}
@@ -168,7 +168,7 @@
   </tr>'
 bookmarks = ../paper/bookmarks.tmpl
 bookmarkentry = '
-  <tr class="tagEntry parity{parity}">
+  <tr class="tagEntry">
     <td>
       <a href="{url|urlescape}rev/{node|short}{sessionvars%urlparameter}">
         {bookmark|escape}
@@ -180,7 +180,7 @@
   </tr>'
 branches = ../paper/branches.tmpl
 branchentry = '
-  <tr class="tagEntry parity{parity}">
+  <tr class="tagEntry">
     <td>
       <a href="{url|urlescape}shortlog/{node|short}{sessionvars%urlparameter}" class="{status}">
         {branch|escape}
@@ -219,7 +219,7 @@
   </tr>'
 
 indexentry = '
-  <tr class="parity{parity}">
+  <tr>
     <td><a href="{url|urlescape}{sessionvars%urlparameter}">{name|escape}</a></td>
     <td>{description}</td>
     <td>{contact|obfuscate}</td>
--- a/mercurial/templates/static/style-coal.css	Wed Jun 24 11:15:00 2015 -0400
+++ b/mercurial/templates/static/style-coal.css	Thu Jun 25 20:27:36 2015 +0800
@@ -97,8 +97,12 @@
 .age { white-space:nowrap; }
 .date { white-space:nowrap; }
 .indexlinks { white-space:nowrap; }
-.parity0 { background-color: #f0f0f0; }
-.parity1 { background-color: white; }
+.parity0,
+.stripes4 > :nth-child(4n+1),
+.stripes2 > :nth-child(2n+1) { background-color: #f0f0f0; }
+.parity1,
+.stripes4 > :nth-child(4n+3),
+.stripes2 > :nth-child(2n+2) { background-color: white; }
 .plusline { color: green; }
 .minusline { color: #dc143c; } /* crimson */
 .atline { color: purple; }
--- a/tests/test-hgweb-descend-empties.t	Wed Jun 24 11:15:00 2015 -0400
+++ b/tests/test-hgweb-descend-empties.t	Thu Jun 25 20:27:36 2015 +0800
@@ -217,7 +217,7 @@
     <td class="permissions">drwxr-xr-x</td>
   </tr>
   
-  <tr class="fileline parity1">
+  <tr class="fileline">
   <td class="name">
   <a href="/file/tip/a1?style=coal">
   <img src="/static/coal-folder.png" alt="dir."/> a1/
@@ -229,7 +229,7 @@
   <td class="size"></td>
   <td class="permissions">drwxr-xr-x</td>
   </tr>
-  <tr class="fileline parity0">
+  <tr class="fileline">
   <td class="name">
   <a href="/file/tip/b1?style=coal">
   <img src="/static/coal-folder.png" alt="dir."/> b1/
@@ -241,7 +241,7 @@
   <td class="size"></td>
   <td class="permissions">drwxr-xr-x</td>
   </tr>
-  <tr class="fileline parity1">
+  <tr class="fileline">
   <td class="name">
   <a href="/file/tip/d1?style=coal">
   <img src="/static/coal-folder.png" alt="dir."/> d1/