spartan: ensure equal heights for file and annotate views
authorMartin Geisler <mg@lazybytes.net>
Tue, 19 May 2009 00:28:47 +0200
changeset 8507 decf329f00cb
parent 8506 93a9f4a0e361
child 8508 8c5e32a4f2f9
spartan: ensure equal heights for file and annotate views The display used to jump up and down when switching from the file view to the annotate view. It now stays still: when switching from the file view to the annotate view it looks like the file content is simply right-shifted to make room for the author names.
templates/spartan/map
templates/static/style.css
tests/test-hgweb-commands.out
--- a/templates/spartan/map	Mon May 18 23:37:36 2009 +0200
+++ b/templates/spartan/map	Tue May 19 00:28:47 2009 +0200
@@ -42,8 +42,12 @@
 fileannotate = fileannotate.tmpl
 filediff = filediff.tmpl
 filelog = filelog.tmpl
-fileline = '<div class="parity{parity}"><a class="lineno" href="#{lineid}" id="{lineid}">{linenumber}</a>{line|escape}</div>'
+fileline = '<div class="parity{parity}"><a class="lineno" href="#{lineid}" id="{lineid}">{linenumber}</a>&nbsp;{line|escape}</div>'
 filelogentry = filelogentry.tmpl
+
+# The &nbsp; ensures that all table cells have content (even if there
+# is an empty line in the annotated file), which in turn ensures that
+# all table rows have equal height.
 annotateline = '
   <tr class="parity{parity}">
     <td class="annotate">
@@ -53,7 +57,7 @@
     <td>
       <a class="lineno" href="#{lineid}" id="{lineid}">{linenumber}</a>
     </td>
-    <td><pre>{line|escape}</pre></td>
+    <td><pre>&nbsp;{line|escape}</pre></td>
   </tr>'
 difflineplus = '<span class="plusline"><a class="lineno" href="#{lineid}" id="{lineid}">{linenumber}</a>{line|escape}</span>'
 difflineminus = '<span class="minusline"><a class="lineno" href="#{lineid}" id="{lineid}">{linenumber}</a>{line|escape}</span>'
--- a/templates/static/style.css	Mon May 18 23:37:36 2009 +0200
+++ b/templates/static/style.css	Tue May 19 00:28:47 2009 +0200
@@ -5,7 +5,7 @@
 .parity0 { background-color: #ddd; }
 .parity1 { background-color: #eee; }
 .lineno { width: 60px; color: #aaa; font-size: smaller;
-          text-align: right; padding-right:1em; }
+          text-align: right; }
 .plusline { color: green; }
 .minusline { color: red; }
 .atline { color: purple; }
--- a/tests/test-hgweb-commands.out	Mon May 18 23:37:36 2009 +0200
+++ b/tests/test-hgweb-commands.out	Tue May 19 00:28:47 2009 +0200
@@ -887,7 +887,7 @@
 .parity0 { background-color: #ddd; }
 .parity1 { background-color: #eee; }
 .lineno { width: 60px; color: #aaa; font-size: smaller;
-          text-align: right; padding-right:1em; }
+          text-align: right; }
 .plusline { color: green; }
 .minusline { color: red; }
 .atline { color: purple; }