]> git.openstreetmap.org Git - rails.git/blobdiff - app/views/trace/_trace_paging_nav.rhtml
Improving friend capabilities so you can now add and remove friends as you wish....
[rails.git] / app / views / trace / _trace_paging_nav.rhtml
index 4811336ab91fa57688cea023136ee438bc35f9dd..a7e752893dd15c7546507b3598a1c07dd1a1b062 100644 (file)
@@ -1,19 +1,12 @@
-<%\r
-  range_start = ((@page - 1) * @traces_per_page) + 1\r
-  range_end = (@page==@max_page ? @max_trace : (@page * @traces_per_page))\r
-%>\r
-\r
-Showing page \r
-<%= @page %> (<%= range_start %><% \r
-if (@max_trace != range_start) # if more than 1 trace on page \r
-  %>-<%= range_end %><% \r
-end %>\r
-of <%= @max_trace %>)\r
-\r
-<% if @page > 1 %>\r
-  | <%= link_to 'previous page', {:controller => 'trace', :action => @paging_action, :page => @page-1}, {:title => 'previous page'} %>\r
-<% end %>\r
-\r
-<% if @page < @max_page %>\r
-  | <%= link_to 'next page', {:controller => 'trace', :action => @paging_action, :page => @page+1}, {:title => 'next page'} %>\r
-<% end %>\r
+<% current_page = @trace_pages.current_page %>
+
+Showing page 
+<%= 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 %>
+of <%= @trace_pages.item_count %>)
+
+<% if @trace_pages.page_count > 1 %>
+ | <%= pagination_links(@trace_pages) %>
+<% end %>