##// 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 def index
30 def index
31 respond_to do |format|
31 respond_to do |format|
32 format.html {
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 @user_count_by_group_id = user_count_by_group_id
39 @user_count_by_group_id = user_count_by_group_id
35 }
40 }
36 format.api {
41 format.api {
@@ -4,6 +4,7
4
4
5 <%= title l(:label_group_plural) %>
5 <%= title l(:label_group_plural) %>
6 <% if @groups.any? %>
6 <% if @groups.any? %>
7 <div class="autoscroll">
7 <table class="list groups">
8 <table class="list groups">
8 <thead><tr>
9 <thead><tr>
9 <th><%=l(:label_group)%></th>
10 <th><%=l(:label_group)%></th>
@@ -20,6 +21,8
20 <% end %>
21 <% end %>
21 </tbody>
22 </tbody>
22 </table>
23 </table>
24 </div>
25 <span class="pagination"><%= pagination_links_full @group_pages, @group_count %></span>
23 <% else %>
26 <% else %>
24 <p class="nodata"><%= l(:label_no_data) %></p>
27 <p class="nodata"><%= l(:label_no_data) %></p>
25 <% end %>
28 <% end %>
General Comments 0
You need to be logged in to leave comments. Login now