1 <%# Copyright (C) The Arvados Authors. All rights reserved.
3 SPDX-License-Identifier: AGPL-3.0 %>
5 <% content_for :css do %>
10 background-color: whitesmoke;
13 display: inline-block;
18 <% results.fetch_multiple_pages(false) %>
20 <% if results.respond_to? :result_offset and
21 results.respond_to? :result_limit and
22 results.respond_to? :items_available and
23 results.result_offset != nil and
24 results.result_limit != nil and
25 results.items_available != nil
27 <div class="index-paging">
28 Displaying <%= results.result_offset+1 %> –
29 <%= if results.result_offset + results.result_limit > results.items_available
30 results.items_available
32 results.result_offset + results.result_limit
34 out of <%= results.items_available %>
37 <% if not (results.result_offset == 0 and results.items_available <= results.result_limit) %>
39 <div class="index-paging">
41 <% if results.result_offset > 0 %>
42 <% if results.result_offset > results.result_limit %>
43 <% prev_offset = results.result_offset - results.result_limit %>
48 <% prev_offset = nil %>
51 <% this_offset = results.result_offset %>
53 <% if (results.result_offset + results.result_limit) < results.items_available %>
54 <% next_offset = results.result_offset + results.result_limit %>
56 <% next_offset = nil %>
59 <span class="pull-left">
60 <% if results.result_offset > 0 %>
61 <%= link_to raw("<span class='glyphicon glyphicon-fast-backward'></span>"), {:id => object, :offset => 0, :limit => results.result_limit} %>
63 <span class='glyphicon glyphicon-fast-backward text-muted'></span>
67 <%= link_to raw("<span class='glyphicon glyphicon-step-backward'></span>"), {:id => object, :offset => prev_offset, :limit => results.result_limit} %>
69 <span class='glyphicon glyphicon-step-backward text-muted'></span>
73 <% first = this_offset - (10 * results.result_limit) %>
74 <% last = this_offset + (11 * results.result_limit) %>
76 <% lastpage_offset = (results.items_available / results.result_limit) * results.result_limit %>
78 <% if last > results.items_available %>
79 <% first -= (last - lastpage_offset) %>
80 <% last -= (last - results.items_available) %>
89 <% last = results.items_available if last > results.items_available %>
92 <% n = first / results.result_limit %>
99 <% if i != this_offset %>
100 <%= link_to "#{n+1}", {:id => @object, :offset => i, :limit => results.result_limit}, class: 'paging-number' %>
102 <span class="paging-number" style="font-weight: bold;"><%= n+1 %></span>
104 <% i += results.result_limit %>
108 <% if last < results.items_available %>
112 <span class="pull-right">
114 <%= link_to raw("<span class='glyphicon glyphicon-step-forward'></span>"), {:id => @object, :offset => next_offset, :limit => results.result_limit} %>
116 <span class='glyphicon glyphicon-forward text-muted'></span>
119 <% if (results.items_available - results.result_offset) >= results.result_limit %>
120 <%= link_to raw("<span class='glyphicon glyphicon-fast-forward'></span>"), {:id => @object, :offset => results.items_available - (results.items_available % results.result_limit),
121 :limit => results.result_limit} %>
123 <span class='glyphicon glyphicon-fast-forward text-muted'></span>