paginate thread replies

This commit is contained in:
jomo
2014-09-22 06:25:23 +02:00
parent ed4096949f
commit 15ca378878
2 changed files with 3 additions and 1 deletions

View File

@@ -7,6 +7,7 @@ class ForumthreadsController < ApplicationController
end end
def show def show
@replies = @thread.replies.page(params[:page])
end end
def edit def edit

View File

@@ -21,9 +21,10 @@
</div> </div>
<div id="replies"> <div id="replies">
<h3><%= "#{pluralize(@thread.replies.length, 'reply')}." %></h3> <h3><%= "#{pluralize(@thread.replies.length, 'reply')}." %></h3>
<% @thread.replies.each do |reply| %> <% @replies.each do |reply| %>
<%= render partial: "threadreplies/reply", locals: {reply: reply} %> <%= render partial: "threadreplies/reply", locals: {reply: reply} %>
<% end %> <% end %>
<%= paginate @replies %>
<% if @thread.can_write?(current_user) %> <% if @thread.can_write?(current_user) %>
<%= render partial: "threadreplies/new", locals: {reply: Threadreply.new(forumthread: @thread)} %> <%= render partial: "threadreplies/new", locals: {reply: Threadreply.new(forumthread: @thread)} %>
<% else %> <% else %>