Added pagination for relationed content list
This commit is contained in:
@@ -19,6 +19,8 @@ class ProposalsController < ApplicationController
|
||||
def show
|
||||
super
|
||||
@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)
|
||||
end
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<ul class="related-content-list" id="related-content-list">
|
||||
<% relationable.relationed_contents.each do |related| %>
|
||||
<% @related_contents.each do |related| %>
|
||||
<li>
|
||||
<a href="#" class="float-right flag">
|
||||
<span class="icon-flag"></span> <!-- This should be similar to comments/flag_actions -->
|
||||
@@ -13,4 +13,4 @@
|
||||
<% end %>
|
||||
</ul>
|
||||
|
||||
<!-- Add pagination here -->
|
||||
<%= paginate @related_contents %>
|
||||
|
||||
Reference in New Issue
Block a user