Class: Decidim::Votings::Admin::MonitoringCommitteeElectionResultsController
- Inherits:
-
ApplicationController
- Object
- Admin::ApplicationController
- ApplicationController
- Decidim::Votings::Admin::MonitoringCommitteeElectionResultsController
- Includes:
- VotingAdmin
- Defined in:
- app/controllers/decidim/votings/admin/monitoring_committee_election_results_controller.rb
Overview
This controller allows a monitoring committee member to list and validate the polling stations closures.
Instance Method Summary collapse
Instance Method Details
#index ⇒ Object
14 15 16 17 18 |
# File 'app/controllers/decidim/votings/admin/monitoring_committee_election_results_controller.rb', line 14 def index :read, :monitoring_committee_election_results, voting: current_voting redirect_to voting_monitoring_committee_election_result_path(current_voting, elections.first) if elections.one? end |
#show ⇒ Object
20 21 22 |
# File 'app/controllers/decidim/votings/admin/monitoring_committee_election_results_controller.rb', line 20 def show :read, :monitoring_committee_election_result, voting: current_voting, election: end |
#update ⇒ Object
24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 |
# File 'app/controllers/decidim/votings/admin/monitoring_committee_election_results_controller.rb', line 24 def update (:validate, :monitoring_committee_election_result, voting: current_voting, election:) if publish_results_form.pending_action Decidim::Elections::Admin::UpdateActionStatus.call(publish_results_form.pending_action) if publish_results_form.pending_action.accepted? flash[:notice] = I18n.t("monitoring_committee_election_results.update.success", scope: "decidim.votings.admin") else flash[:alert] = I18n.t("monitoring_committee_election_results.update.rejected", scope: "decidim.votings.admin") end return redirect_to voting_monitoring_committee_election_result_path(current_voting, election) end Decidim::Elections::Admin::PublishResults.call(publish_results_form) do on(:invalid) do flash.now[:alert] = I18n.t("monitoring_committee_election_results.update.invalid", scope: "decidim.votings.admin") end on(:ok) do publish_results_form.refresh end end render :show end |