Added pagination for relationed content list

This commit is contained in:
María Checa
2017-12-14 10:43:35 +01:00
parent d6fd83915d
commit 1830a7bb04
2 changed files with 4 additions and 2 deletions

View File

@@ -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

View File

@@ -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 %>