summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWill Woods <wwoods@redhat.com>2009-09-24 17:00:40 -0400
committerWill Woods <wwoods@redhat.com>2009-09-24 17:00:40 -0400
commit23f97cda9cc29f66e5a36162dad4a624ed33a638 (patch)
tree1964ed1618d9795efe471f9d8d490ee79fb6e22d
parent7e3e8cae6d57f1ba225011ef6072dd05e85b64df (diff)
downloadisrawhidebroken-23f97cda9cc29f66e5a36162dad4a624ed33a638.tar.gz
israwhidebroken-23f97cda9cc29f66e5a36162dad4a624ed33a638.tar.xz
israwhidebroken-23f97cda9cc29f66e5a36162dad4a624ed33a638.zip
Add links to prev/next compose
-rw-r--r--israwhidebroken/controllers.py15
-rw-r--r--israwhidebroken/templates/index.html4
2 files changed, 14 insertions, 5 deletions
diff --git a/israwhidebroken/controllers.py b/israwhidebroken/controllers.py
index ecd11a2..9727b47 100644
--- a/israwhidebroken/controllers.py
+++ b/israwhidebroken/controllers.py
@@ -16,12 +16,19 @@ class Root(controllers.RootController):
# Main index page
@expose(template="israwhidebroken.templates.index")
def index(self, c=None):
+ c = to_int(c)
+ # FIXME This is really, really stupid - use a LIMIT or something
+ composelist = sorted(set([t.compose_id for t in Tree.select()]))
if not c:
- newest_tree = Tree.select(orderBy='-compose_id')[0]
- c = newest_tree.compose_id
+ c = composelist[-1]
+ prev = composelist[-2]
+ next = None
+ elif c in composelist:
+ idx = composelist.index(c)
+ prev = (idx > 0) and composelist[idx-1] or None
+ next = (idx+1 < len(composelist)) and composelist[idx+1] or None
# FIXME BLUH WIDGETIFY THIS
- # TODO need id of prev/next compose for navigation/browsing
- return dict(c=c,
+ return dict(c=c, prev=prev, next=next,
in_qa='qa' in identity.current.groups,
admin='qa-admin' in identity.current.groups,
tests=Test.select(),
diff --git a/israwhidebroken/templates/index.html b/israwhidebroken/templates/index.html
index bf8474e..24b2451 100644
--- a/israwhidebroken/templates/index.html
+++ b/israwhidebroken/templates/index.html
@@ -26,7 +26,9 @@ for tree in trees:
<body>
<table id="results">
- <th>Rawhide compose ${c}</th>
+ <th><a href="${prev and tg.url('/?c=%u' % prev)}">«</a>
+ Rawhide compose ${c}
+ <a href="${next and tg.url('/?c=%u' % next)}">»</a></th>
<th py:for="tree in trees">${tree.arch}</th>
<tr py:for="test in tests">
<td><a href="${test.uri}">${test.name}</a></td>