Class: Decidim::Votings::Admin::MonitoringCommitteePollingStationClosuresController
- Inherits:
-
ApplicationController
- Object
- Admin::ApplicationController
- ApplicationController
- Decidim::Votings::Admin::MonitoringCommitteePollingStationClosuresController
- Defined in:
- app/controllers/decidim/votings/admin/monitoring_committee_polling_station_closures_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
#edit ⇒ Object
23 24 25 26 27 |
# File 'app/controllers/decidim/votings/admin/monitoring_committee_polling_station_closures_controller.rb', line 23 def edit (:validate, :monitoring_committee_polling_station_closure, voting: current_voting, closure:) @form = form(MonitoringCommitteePollingStationClosureForm).from_model(closure) end |
#index ⇒ Object
13 14 15 16 17 |
# File 'app/controllers/decidim/votings/admin/monitoring_committee_polling_station_closures_controller.rb', line 13 def index :read, :monitoring_committee_polling_station_closures, voting: current_voting redirect_to voting_monitoring_committee_polling_station_closures_path(current_voting, election_id: elections.first.id) if elections.one? && params[:election_id].blank? end |
#show ⇒ Object
19 20 21 |
# File 'app/controllers/decidim/votings/admin/monitoring_committee_polling_station_closures_controller.rb', line 19 def show :read, :monitoring_committee_polling_station_closure, voting: current_voting, closure: end |
#validate ⇒ Object
29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 |
# File 'app/controllers/decidim/votings/admin/monitoring_committee_polling_station_closures_controller.rb', line 29 def validate (:validate, :monitoring_committee_polling_station_closure, voting: current_voting, closure:) @form = form(MonitoringCommitteePollingStationClosureForm).from_params(params) MonitoringCommitteeValidatePollingStationClosure.call(@form, closure) do on(:ok) do flash[:notice] = t(".success") end on(:invalid) do flash[:alert] = t(".error") end end redirect_to voting_monitoring_committee_polling_station_closures_path(current_voting, election_id: closure.election.id) end |