Rework the pagination of the trace list to avoid having to count

the total number of matching records/pages.
This commit is contained in:
Tom Hughes 2010-01-14 00:35:09 +00:00
parent fa554045e5
commit 62e7006a21
41 changed files with 27 additions and 126 deletions

View file

@ -1,12 +1,17 @@
<% current_page = @trace_pages.current_page %>
<p>
<%= t'trace.trace_paging_nav.showing' %>
<%= current_page.number %> (<%= current_page.first_item %><%
if (current_page.first_item < current_page.last_item) # if more than 1 trace on page
%>-<%= current_page.last_item %><%
end %>
<%= t'trace.trace_paging_nav.of' %> <%= @trace_pages.item_count %>)
<% if @trace_pages.page_count > 1 %>
| <%= pagination_links_each(@trace_pages, {}) { |n| link_to_page(n) } %>
<% if @page > 1 %>
<%= link_to t('trace.trace_paging_nav.previous'), params.merge({ :page => @page - 1 }) %>
<% else %>
<%= t('trace.trace_paging_nav.previous') %>
<% end %>
| <%= t('trace.trace_paging_nav.showing_page', :page => @page) %> |
<% if @traces.size < @page_size %>
<%= t('trace.trace_paging_nav.next') %>
<% else %>
<%= link_to t('trace.trace_paging_nav.next'), params.merge({ :page => @page + 1 }) %>
<% end %>
</p>