adds print of new proposals

This commit is contained in:
rgarcia
2015-10-06 14:27:34 +02:00
parent 0acdf5722b
commit 015e57ddad
4 changed files with 77 additions and 8 deletions

View File

@@ -1,18 +1,23 @@
class Management::ProposalsController < Management::BaseController
skip_before_action :verify_manager
include HasOrders
include CommentableActions
before_action :set_proposal, only: :vote
before_action :parse_search_terms, only: :index
has_orders %w{hot_score confidence_score created_at most_commented random}, only: :index
has_orders %w{hot_score confidence_score created_at most_commented random}, only: [:index, :print]
def vote
@proposal.register_vote(current_user, 'yes')
redirect_to management_proposals_url, notice: "Succesfully voted"
end
def print
@proposals = Proposal.all.page(params[:page]).for_render.send("sort_by_#{@current_order}")
end
private
def set_proposal
@@ -33,4 +38,9 @@ class Management::ProposalsController < Management::BaseController
Proposal
end
#Duplicated in application_controller. Move to a concenrn.
def set_proposal_votes(proposals)
@proposal_votes = current_user ? current_user.proposal_votes(proposals) : {}
end
end