Fixes #135
Adds a table with proposed actions in the dashboard. The user can mark an action as executed.
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user