Added pagination for relationed content list
This commit is contained in:
@@ -19,6 +19,8 @@ class ProposalsController < ApplicationController
|
|||||||
def show
|
def show
|
||||||
super
|
super
|
||||||
@notifications = @proposal.notifications
|
@notifications = @proposal.notifications
|
||||||
|
@related_contents = Kaminari.paginate_array(@proposal.relationed_contents).page(params[:page]).per(5)
|
||||||
|
|
||||||
redirect_to proposal_path(@proposal), status: :moved_permanently if request.path != proposal_path(@proposal)
|
redirect_to proposal_path(@proposal), status: :moved_permanently if request.path != proposal_path(@proposal)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
<ul class="related-content-list" id="related-content-list">
|
<ul class="related-content-list" id="related-content-list">
|
||||||
<% relationable.relationed_contents.each do |related| %>
|
<% @related_contents.each do |related| %>
|
||||||
<li>
|
<li>
|
||||||
<a href="#" class="float-right flag">
|
<a href="#" class="float-right flag">
|
||||||
<span class="icon-flag"></span> <!-- This should be similar to comments/flag_actions -->
|
<span class="icon-flag"></span> <!-- This should be similar to comments/flag_actions -->
|
||||||
@@ -13,4 +13,4 @@
|
|||||||
<% end %>
|
<% end %>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
<!-- Add pagination here -->
|
<%= paginate @related_contents %>
|
||||||
|
|||||||
Reference in New Issue
Block a user