Add a paging control to the user blocks list
authorTom Hughes <tom@compton.nu>
Wed, 18 Jul 2012 20:28:09 +0000 (21:28 +0100)
committerTom Hughes <tom@compton.nu>
Wed, 18 Jul 2012 20:36:40 +0000 (21:36 +0100)
app/views/user_blocks/_blocks.html.erb
config/locales/en.yml

index 7127cc283721059a1e4c52b938b0d38a02f0518a..12f0c7ced4224ee4fee2f0b086045e4f14a011e5 100644 (file)
   </tr>
   <%= render :partial => 'block', :locals => {:show_revoke_link => show_revoke_link, :show_user_name => show_user_name, :show_creator_name => show_creator_name }, :collection => @user_blocks %>
 </table>
+
+<p>
+  <% if @user_blocks_pages.current_page.number > 1 -%>
+    <%= link_to t('user_block.partial.previous'), params.merge({ :page => @user_blocks_pages.current_page.number - 1 }) %>
+  <% else -%>
+    <%= t('user_block.partial.previous') %>
+  <% end -%>
+
+  | <%= t('user_block.partial.showing_page', :page => @user_blocks_pages.current_page.number) %> |
+
+  <% if @user_blocks_pages.current_page.number < @user_blocks_pages.page_count -%>
+    <%= link_to t('user_block.partial.next'), params.merge({ :page => @user_blocks_pages.current_page.number + 1 }) %>
+  <% else -%>
+    <%= t('user_block.partial.next') %>
+  <% end -%>
+</p>
index e1f7f416a0114f53c37f27fa6d07a251f4b578ad..56fca54058fb5787a28e9b6ca1f021c6a032140d 100644 (file)
@@ -1961,6 +1961,9 @@ en:
       status: "Status"
       revoker_name: "Revoked by"
       not_revoked: "(not revoked)"
+      showing_page: "Showing page %{page}"
+      next: "Next »"
+      previous: "« Previous"
     helper:
       time_future: "Ends in %{time}."
       until_login: "Active until the user logs in."