paginate thread replies
This commit is contained in:
@@ -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
|
||||||
|
|||||||
@@ -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 %>
|
||||||
|
|||||||
Reference in New Issue
Block a user