Files
grecia/app/controllers/dashboard_controller.rb
taitus 1f97a996f8 Move resource partial to a component
We're renaming it to ActiveResource in order to better differentiate it
from the DefaultResource component.
2025-08-27 17:40:45 +02:00

46 lines
933 B
Ruby

class DashboardController < Dashboard::BaseController
helper_method :dashboard_action, :course
before_action :set_done_and_pending_actions, only: [:recommended_actions, :progress]
before_action :authorize_dashboard, except: :publish
def show
end
def publish
authorize! :publish, proposal
proposal.publish
redirect_to progress_proposal_dashboard_path(proposal), notice: t("proposals.notice.published")
end
def progress
end
def community
end
def recommended_actions
end
def messages
end
def related_content
end
private
def course
@course ||= Dashboard::Action.course_for(proposal)
end
def set_done_and_pending_actions
@done_actions = proposed_actions.joins(:proposals).where(proposals: { id: proposal.id })
@pending_actions = proposed_actions - @done_actions
end
def authorize_dashboard
authorize! :dashboard, proposal
end
end