adds pagination to admin lists

Ref: #80
This commit is contained in:
Juanjo Bazán
2015-08-19 14:08:22 +02:00
committed by Juanjo Bazán
parent a43c753ebb
commit fda8412ed3
8 changed files with 20 additions and 6 deletions

View File

@@ -1,7 +1,7 @@
class Admin::CommentsController < Admin::BaseController
def index
@comments = Comment.only_hidden
@comments = Comment.only_hidden.page(params[:page])
end
def restore

View File

@@ -1,7 +1,7 @@
class Admin::DebatesController < Admin::BaseController
def index
@debates = Debate.only_hidden
@debates = Debate.only_hidden.page(params[:page])
end
def show

View File

@@ -6,7 +6,7 @@ class Admin::OrganizationsController < Admin::BaseController
def index
@organizations = @organizations.send(@filter)
@organizations = @organizations.includes(:user).order(:name, 'users.email')
@organizations = @organizations.includes(:user).order(:name, 'users.email').page(params[:page])
end
def verify

View File

@@ -4,7 +4,7 @@ class Admin::TagsController < Admin::BaseController
respond_to :html, :js
def index
@tags = ActsAsTaggableOn::Tag.order(featured: :desc)
@tags = ActsAsTaggableOn::Tag.order(featured: :desc).page(params[:page])
@tag = ActsAsTaggableOn::Tag.new
end

View File

@@ -1,5 +1,7 @@
<h2><%= t("admin.comments.index.title") %></h2>
<h3><%= page_entries_info @comments %></h3>
<ul class="admin-list">
<% @comments.each do |comment| %>
<li id="<%= dom_id(comment) %>">
@@ -16,3 +18,5 @@
</li>
<% end %>
</ul>
<%= paginate @comments %>

View File

@@ -1,5 +1,7 @@
<h2><%= t("admin.debates.index.title") %></h2>
<h3><%= page_entries_info @debates %></h3>
<ul class="admin-list">
<% @debates.each do |debate| %>
<li id="<%= dom_id(debate) %>">
@@ -11,3 +13,5 @@
</li>
<% end %>
</ul>
<%= paginate @debates %>

View File

@@ -13,6 +13,8 @@
<% end %>
</p>
<h3><%= page_entries_info @organizations %></h3>
<table>
<% @organizations.each do |organization| %>
<tr>
@@ -42,3 +44,5 @@
</tr>
<% end %>
</table>
<%= paginate @organizations %>

View File

@@ -20,7 +20,7 @@
<% end %>
<h3><%= t("admin.tags.index.title") %></h3>
<h3><%= t("admin.tags.index.title") %>: <%= page_entries_info @tags %></h3>
<ul class="admin-list">
<% @tags.each do |tag| %>
@@ -44,3 +44,5 @@
</li>
<% end %>
</ul>
<%= paginate @tags %>