Adds a table with proposed actions in the dashboard. The user can mark
an action as executed.
This commit is contained in:
Juan Salvador Pérez García
2018-06-15 11:55:36 +02:00
parent 9f27d73240
commit 83f78b1940
14 changed files with 183 additions and 10 deletions

View File

@@ -4,7 +4,7 @@
class ProposalsDashboardController < ApplicationController
before_action :authenticate_user!
helper_method :proposal
helper_method :proposal, :proposed_actions
respond_to :html
layout 'proposals_dashboard'
@@ -19,9 +19,23 @@ class ProposalsDashboardController < ApplicationController
redirect_to proposal_dashboard_index_path(proposal), notice: t('proposals.notice.published')
end
def execute
authorize! :dashboard, proposal
ProposalExecutedDashboardAction.create(proposal: proposal, proposal_dashboard_action: proposal_dashboard_action, executed_at: Time.now)
redirect_to proposal_dashboard_index_path(proposal.to_param)
end
private
def proposal_dashboard_action
@proposal_dashboard_action ||= ProposalDashboardAction.find(params[:id])
end
def proposal
@proposal ||= Proposal.find(params[:proposal_id])
end
def proposed_actions
@proposed_actions ||= ProposalDashboardAction.proposed_actions.active_for(proposal)
end
end