changeset 173:8da1df932c16

hgweb: make navigation of changesets a bit nicer
author mpm@selenic.com
date Thu, 26 May 2005 22:47:43 -0800
parents e9b1147db448
children 23057dc57d1b
files mercurial/hgweb.py templates/changelog.tmpl templates/changelogentry.tmpl templates/map
diffstat 4 files changed, 19 insertions(+), 19 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/hgweb.py	Thu May 26 20:37:05 2005 -0800
+++ b/mercurial/hgweb.py	Thu May 26 22:47:43 2005 -0800
@@ -199,22 +199,25 @@
         def changenav():
             def seq(factor = 1):
                 yield 1 * factor
-                yield 2 * factor
-                yield 5 * factor
+                yield 3 * factor
+                #yield 5 * factor
                 for f in seq(factor * 10):
                     yield f
-                    
-            linear = range(0, count - 2, self.maxchanges)[0:8]
-
-            for i in linear:
-                yield self.t("naventry", rev = max(i, 1))
 
-            for s in seq():
-                if s > count - 2: break
-                if s > linear[-1]:
-                    yield self.t("naventry", rev = s)
+            l = []
+            for f in seq():
+                if f < self.maxchanges / 2: continue
+                if f > count: break
+                r = "%d" % f
+                if pos + f < count - (f/2): l.append(("+" + r, pos + f))
+                if pos - f >= 0 + (f/2): l.insert(0, ("-" + r, pos - f))
+
+            yield self.t("naventry", rev = 0, label="(0)")
                     
-            yield self.t("naventry", rev = count - 1)
+            for label, rev in l:
+                yield self.t("naventry", label = label, rev = rev)
+
+            yield self.t("naventry", rev = count - 1, label="tip")
 
         def changelist():
             parity = (start - end) & 1
--- a/templates/changelog.tmpl	Thu May 26 20:37:05 2005 -0800
+++ b/templates/changelog.tmpl	Thu May 26 22:47:43 2005 -0800
@@ -14,7 +14,7 @@
 search:
 <input type="hidden" name="cmd" value="changelog">
 <input name="rev" type="text" width="30">
-navigate: #changenav#<br/>
+navigate: <small>#changenav#</small><br/>
 </form>
 
 #entries#
@@ -23,7 +23,7 @@
 search:
 <input type="hidden" name="cmd" value="changelog">
 <input name="rev" type="text" width="30">
-navigate: #changenav#<br/>
+navigate: <small>#changenav#</small><br/>
 </form>
 
 #footer#
--- a/templates/changelogentry.tmpl	Thu May 26 20:37:05 2005 -0800
+++ b/templates/changelogentry.tmpl	Thu May 26 22:47:43 2005 -0800
@@ -9,16 +9,13 @@
 #parent1#
 #parent2#
 <tr>
- <td align="right">manifest:&nbsp;</td>
- <td><a href="?cmd=manifest;manifest=#manifest#;path=/">#manifest#</a></td></tr>
-<tr>
  <td align="right">author:&nbsp;</td>
  <td>#author#</td></tr>
 <tr>
  <td align="right">date:&nbsp;</td>
  <td>#date#</td></tr>
 <tr>
- <td align="right" valign="top">files:&nbsp;</td>
+ <td align="right" valign="top"><a href="?cmd=manifest;manifest=#manifest#;path=/">files</a>:&nbsp;</td>
  <td>#files#</td></tr>
 </table>
 </div>
--- a/templates/map	Thu May 26 20:37:05 2005 -0800
+++ b/templates/map	Thu May 26 22:47:43 2005 -0800
@@ -1,7 +1,7 @@
 header = header.tmpl
 footer = footer.tmpl
 changelog = changelog.tmpl
-naventry = "<a href="?cmd=changelog;rev=#rev#">#rev#</a> "
+naventry = "<a href="?cmd=changelog;rev=#rev#">#label#</a> "
 filedifflink = "<a href="?cmd=filediff;node=#node#;file=#file#">#file#</a> "
 filenodelink = "<a href="?cmd=file;filenode=#filenode#;file=#file#">#file#</a> "
 fileellipses = "..."