]> git.xonotic.org Git - xonotic/xonstat.git/blob - xonstat/templates/navlinks.mako
Add basic search to the index pages.
[xonotic/xonstat.git] / xonstat / templates / navlinks.mako
1 <%def name="navlinks(view, curr, last)">
2 % if curr != last:
3     % if curr != 1:
4     <a class="pagination" href="${request.route_url(view, page=curr-1)}" name="Previous Page">previous</a>
5     % endif
6
7     % if last < 8:
8         % for i in range(1, last+1):
9         ${link_page(view, i, curr)}
10         % endfor
11     % else:
12         % if curr < 5:
13             % for i in range(1,7):
14             ${link_page(view, i, curr)}
15             % endfor
16             <span class="pagination">...</span>
17             <a class="pagination" href="${request.route_url(view, page=last)}" name="Last Page">${last}</a>
18         % elif last-curr < 6:
19             <a class="pagination" href="${request.route_url(view, page=1)}" name="First Page">1</a>
20             <span class="pagination">...</span>
21             % for i in range(last-5, last+1):
22             ${link_page(view, i, curr)}
23             % endfor
24         % else:
25             <a class="pagination" href="${request.route_url(view, page=1)}" name="First Page">1</a>
26             <span class="pagination">...</span>
27             % for i in range(curr-2, curr+3):
28             ${link_page(view, i, curr)}
29             % endfor
30             <span class="pagination">...</span>
31             <a class="pagination" href="${request.route_url(view, page=last)}" name="Last Page">${last}</a>
32         % endif
33     % endif
34
35     % if curr != last:
36     <a class="pagination" href="${request.route_url(view, page=curr+1)}" name="Next Page">next</a>
37     % endif
38 % endif
39 </%def>
40
41 <%def name="link_page(view, page_num, curr_page)">
42 % if page_num == curr_page:
43 <span class="pagination" style="color:#d95b00;">${page_num}</span>
44 % else:
45 <a class="pagination" href="${request.route_url(view, page=page_num)}" name="Go to page ${page_num}">${page_num}</a>
46 % endif
47 </%def>