Class: Decidim::Votings::Admin::PollingOfficersController
- Inherits:
-
ApplicationController
- Object
- Admin::ApplicationController
- ApplicationController
- Decidim::Votings::Admin::PollingOfficersController
- Includes:
- PollingOfficers::Admin::Filterable, VotingAdmin
- Defined in:
- app/controllers/decidim/votings/admin/polling_officers_controller.rb
Overview
This controller allows to create or update a polling officer.
Instance Method Summary collapse
Instance Method Details
#create ⇒ Object
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'app/controllers/decidim/votings/admin/polling_officers_controller.rb', line 18 def create :create, :polling_officer, voting: current_voting @form = form(VotingUserRoleForm).from_params(params, voting: current_voting) CreatePollingOfficer.call(@form, current_user, current_voting) do on(:ok) do flash[:notice] = I18n.t("polling_officers.create.success", scope: "decidim.votings.admin") redirect_to voting_polling_officers_path(current_voting) end on(:invalid) do flash.now[:alert] = I18n.t("polling_officers.create.invalid", scope: "decidim.votings.admin") render action: "new" end end end |
#destroy ⇒ Object
35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 |
# File 'app/controllers/decidim/votings/admin/polling_officers_controller.rb', line 35 def destroy (:delete, :polling_officer, voting: current_voting, polling_officer:) DestroyPollingOfficer.call(polling_officer, current_user) do on(:ok) do flash[:notice] = I18n.t("polling_officers.destroy.success", scope: "decidim.votings.admin") end on(:invalid) do flash.now[:alert] = I18n.t("polling_officers.destroy.invalid", scope: "decidim.votings.admin") end end redirect_to voting_polling_officers_path(current_voting) end |
#new ⇒ Object
13 14 15 16 |
# File 'app/controllers/decidim/votings/admin/polling_officers_controller.rb', line 13 def new :create, :polling_officer, voting: current_voting @form = form(VotingUserRoleForm).instance end |