xref: /OK3568_Linux_fs/yocto/poky/bitbake/lib/toaster/toastergui/templates/detail_pagination_bottom.html (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1{% comment %}
2    Show pagination controls as per search/pagination table detail spec.
3    Input: objects, setup for pagination using the standard method in views.
4           object_count, count for complete list of objects, (all pages, no pattern)
5{% endcomment %}
6
7{# only paginate if 10 or more rows unfiltered, all pages #}
8{% if object_count >= 10 %}
9<div id="pagination-detail">
10  <ul class="pagination">
11{%if objects.has_previous %}
12    <li><a href="javascript:reload_params({'page':{{objects.previous_page_number}}})">&laquo;</a></li>
13{%else%}
14    <li class="disabled"><a href="#">&laquo;</a></li>
15{%endif%}
16{% for i in objects.page_range %}
17    <li{%if i == objects.number %} class="active" {%endif%}><a href="javascript:reload_params({'page':{{i}}})">{{i}}</a></li>
18{% endfor %}
19{%if objects.has_next%}
20    <li><a href="javascript:reload_params({'page':{{objects.next_page_number}}})">&raquo;</a></li>
21{%else%}
22    <li class="disabled"><a href="#">&raquo;</a></li>
23{%endif%}
24  </ul>
25
26  <form class="navbar-form navbar-right">
27    <div class=form-group">
28      <label>Show rows:</label>
29      <select class="pagesize form-control">
30        {% with "10 25 50 100 150" as list%}
31        {% for i in list.split %}
32        <option value="{{i}}">{{i}}</option>
33        {% endfor %}
34        {% endwith %}
35      </select>
36    </div>
37  </form>
38</div>
39
40<!-- Update page display settings -->
41<script>
42 $(document).ready(function() {
43    // load data for number of entries to be displayed on page
44    if ({{request.GET.count}} != "") {
45      pagesize = {{request.GET.count}};
46    }
47    $('.pagesize option').prop('selected', false)
48                         .filter('[value="' + pagesize + '"]')
49                         .attr('selected', true);
50
51    $(".pagesize").change(function () {
52        reload_params({"count":$(this).val()});
53    });
54});
55</script>
56{% endif %}
57
58