hgweb: make navigation of changesets a bit nicer

This commit is contained in:
mpm@selenic.com 2005-05-26 22:47:43 -08:00
parent 1dd7e5c920
commit d5d19174b2
4 changed files with 18 additions and 18 deletions

View File

@ -199,22 +199,25 @@ class hgweb:
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))
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))
for s in seq():
if s > count - 2: break
if s > linear[-1]:
yield self.t("naventry", rev = s)
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

View File

@ -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 @@ navigate: #changenav#<br/>
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#

View File

@ -8,9 +8,6 @@
<td><a href="?cmd=changeset;node=#node#">#node#</a></td></tr>
#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>
@ -18,7 +15,7 @@
<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>

View File

@ -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 = "..."