##// END OF EJS Templates
Adds pagination to group list....
Jean-Philippe Lang -
r15374:58c3270a7d99
parent child
Show More
@@ -30,7 +30,12 class GroupsController < ApplicationController
30 30 def index
31 31 respond_to do |format|
32 32 format.html {
33 @groups = Group.sorted.to_a
33 scope = Group.sorted
34 scope = scope.like(params[:name]) if params[:name].present?
35
36 @group_count = scope.count
37 @group_pages = Paginator.new @group_count, per_page_option, params['page']
38 @groups = scope.limit(@group_pages.per_page).offset(@group_pages.offset).to_a
34 39 @user_count_by_group_id = user_count_by_group_id
35 40 }
36 41 format.api {
@@ -4,6 +4,7
4 4
5 5 <%= title l(:label_group_plural) %>
6 6 <% if @groups.any? %>
7 <div class="autoscroll">
7 8 <table class="list groups">
8 9 <thead><tr>
9 10 <th><%=l(:label_group)%></th>
@@ -20,6 +21,8
20 21 <% end %>
21 22 </tbody>
22 23 </table>
24 </div>
25 <span class="pagination"><%= pagination_links_full @group_pages, @group_count %></span>
23 26 <% else %>
24 27 <p class="nodata"><%= l(:label_no_data) %></p>
25 28 <% end %>
General Comments 0
You need to be logged in to leave comments. Login now