[ARVADOS] updated: e63c37081683a418bf1ad7b9428ffaf24fe6a8f1
git at public.curoverse.com
git at public.curoverse.com
Fri Mar 14 09:59:30 EDT 2014
Summary of changes:
.../app/views/application/_paging.html.erb | 61 +++++++++++++++-----
1 files changed, 47 insertions(+), 14 deletions(-)
via e63c37081683a418bf1ad7b9428ffaf24fe6a8f1 (commit)
from 44e147b16322f9bdd4606cda7deec631b951ab06 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
commit e63c37081683a418bf1ad7b9428ffaf24fe6a8f1
Author: Peter Amstutz <peter.amstutz at curoverse.com>
Date: Fri Mar 14 09:59:27 2014 -0400
Added "Displaying X of Y out of Z"
Improved links to adjacent pages
diff --git a/apps/workbench/app/views/application/_paging.html.erb b/apps/workbench/app/views/application/_paging.html.erb
index f5677f7..463e65a 100644
--- a/apps/workbench/app/views/application/_paging.html.erb
+++ b/apps/workbench/app/views/application/_paging.html.erb
@@ -5,10 +5,26 @@ padding-left: 1em;
padding-right: 1em;
background-color: whitesmoke;
}
+.paging-number {
+display: inline-block;
+min-width: 1.2em;
+}
<% end %>
<% if results.result_offset != nil and results.result_limit != nil and results.items_available != nil %>
<div class="index-paging">
+ Displaying <%= results.result_offset+1 %> –
+ <%= if results.result_offset + results.result_limit > results.items_available
+ results.items_available
+ else
+ results.result_offset + results.result_limit
+ end %>
+ out of <%= results.items_available %>
+</div>
+
+<% if not (results.result_offset == 0 and results.items_available <= results.result_limit) %>
+
+<div class="index-paging">
<% if results.result_offset > 0 %>
<% if results.result_offset > results.result_limit %>
@@ -21,7 +37,6 @@ background-color: whitesmoke;
<% end %>
<% this_offset = results.result_offset %>
-<% this_page = results.result_offset / results.result_limit %>
<% if (results.result_offset + results.result_limit) < results.items_available %>
<% next_offset = results.result_offset + results.result_limit %>
@@ -43,27 +58,42 @@ background-color: whitesmoke;
<% end %>
</span>
-<% n = this_page - 10 %>
-<% if n >= 0 %>
- <% last = this_page + 10 %>
- …
-<% else %>
- <% n = 0 %>
- <% last = 20 %>
+<% first = this_offset - (10 * results.result_limit) %>
+<% last = this_offset + (11 * results.result_limit) %>
+
+<% lastpage_offset = (results.items_available / results.result_limit) * results.result_limit %>
+
+<% if last > results.items_available %>
+ <% first -= (last - lastpage_offset) %>
+ <% last -= (last - results.items_available) %>
+<% end %>
+
+<% if first < 0 %>
+ <% d = -first %>
+ <% first += d %>
+ <% last += d %>
<% end %>
-<% i = n * results.result_limit %>
-<% while i < results.items_available and n < last %>
-<% if n != this_page %>
- <%= link_to "#{n+1}", {:id => @object, :offset => i, :limit => results.result_limit} %>
+<% last = results.items_available if last > results.items_available %>
+
+<% i = first %>
+<% n = first / results.result_limit %>
+
+<% if first > 0 %>
+…
+<% end %>
+
+<% while i < last %>
+<% if i != this_offset %>
+ <%= link_to "#{n+1}", {:id => @object, :offset => i, :limit => results.result_limit}, class: 'paging-number' %>
<% else %>
- <%= n+1 %>
+ <span class="paging-number" style="font-weight: bold;"><%= n+1 %></span>
<% end %>
<% i += results.result_limit %>
<% n += 1 %>
<% end %>
-<% if i < results.items_available %>
+<% if last < results.items_available %>
…
<% end %>
@@ -84,4 +114,7 @@ background-color: whitesmoke;
</span>
</div>
+
+<% end %>
+
<% end %>
-----------------------------------------------------------------------
hooks/post-receive
--
More information about the arvados-commits
mailing list