summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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>