Remove Persona since it was shut down. :(
[xonotic/xonstat.git] / xonstat / templates / navlinks.mako
1 <%def name="navlinks(view, curr, last, **kwargs)">
2 <%
3 kwargs['_query'] = {'page': None}
4
5 if 'search_query' in kwargs.keys():
6     kwargs['_query'] = dict(kwargs['_query'].items() + kwargs['search_query'].items())
7 %>
8
9 % if not last:
10     <% last = 1 %>
11 % endif
12
13 % if not (curr == last and curr == 1):
14 <div class="row">
15 <div class="small-12 columns text-center">
16 <ul class="pagination">
17     % if curr != 1:
18             <% kwargs['_query']['page'] = curr-1 %>
19             <li><a href="${request.route_url(view, **kwargs)}" name="Previous Page"><i class="fa fa-arrow-left"></i></a></li>
20     % endif
21
22     % if last < 8:
23         % for i in range(1, last+1):
24         ${link_page(view, i, curr, **kwargs)}
25         % endfor
26     % else:
27         % if curr < 5:
28             % for i in range(1,7):
29             ${link_page(view, i, curr, **kwargs)}
30             % endfor
31             <li><span>...<span></li>
32             <% kwargs['_query']['page'] = last %>
33             <li><a  href="${request.route_url(view, **kwargs)}" name="Last Page">${last}</a></li>
34
35         % elif last-curr < 6:
36             <% kwargs['_query']['page'] = 1 %>
37             <li><a  href="${request.route_url(view, **kwargs)}" name="First Page">1</a></li>
38             <li><span >...</span></li>
39             % for i in range(last-5, last+1):
40             ${link_page(view, i, curr, **kwargs)}
41             % endfor
42         % else:
43             <% kwargs['_query']['page'] = 1 %>
44             <li><a  href="${request.route_url(view, **kwargs)}" name="First Page">1</a></li>
45
46             <li><span >...</span></li>
47             % for i in range(curr-2, curr+3):
48             ${link_page(view, i, curr, **kwargs)}
49             % endfor
50             <li><span >...</span></li>
51             <% kwargs['_query']['page'] = last %>
52             <li><a  href="${request.route_url(view, **kwargs)}" name="Last Page">${last}</a></li>
53
54         % endif
55     % endif
56
57     % if curr != last:
58             <% kwargs['_query']['page'] = curr+1 %>
59         <li><a  href="${request.route_url(view, **kwargs)}" name="Next Page"><i class="fa fa-arrow-right"></i></a></li>
60     % endif
61 </ul>
62 </div> <!-- end span12 -->
63 </div> <!-- end row -->
64 % endif
65 </%def>
66
67 <%def name="link_page(view, page_num, curr_page, **kwargs)">
68 % if page_num == curr_page:
69 <li>${page_num}</li>
70 % else:
71     <% kwargs['_query']['page'] = page_num %>
72     <li><a  href="${request.route_url(view, **kwargs)}" name="Go to page ${page_num}">${page_num}</a></li>
73 % endif
74 </%def>