Class: Decidim::Votings::PollingOfficerZone::InPersonVotesController
Overview
Space to manage the elections for a Polling Station Officer
Instance Method Summary
collapse
#ballot_questions, #can_preview?, #default_vote_flow, #preview_mode?, #vote_flow
Instance Method Details
#create ⇒ Object
24
25
26
27
28
29
30
31
32
33
34
|
# File 'app/controllers/decidim/votings/polling_officer_zone/in_person_votes_controller.rb', line 24
def create
enforce_permission_to(:manage, :in_person_vote, polling_officer:)
return if has_pending_in_person_vote?
if verified_voter?
store_in_person_vote
else
identify_voter
end
end
|
#new ⇒ Object
18
19
20
21
22
|
# File 'app/controllers/decidim/votings/polling_officer_zone/in_person_votes_controller.rb', line 18
def new
enforce_permission_to(:manage, :in_person_vote, polling_officer:)
has_pending_in_person_vote?
end
|
#show ⇒ Object
36
37
38
|
# File 'app/controllers/decidim/votings/polling_officer_zone/in_person_votes_controller.rb', line 36
def show
enforce_permission_to :manage, :in_person_vote, polling_officer:
end
|
#update ⇒ Object
40
41
42
43
44
45
46
47
48
49
50
51
52
53
|
# File 'app/controllers/decidim/votings/polling_officer_zone/in_person_votes_controller.rb', line 40
def update
enforce_permission_to(:manage, :in_person_vote, polling_officer:)
Decidim::Votings::Voter::UpdateInPersonVoteStatus.call(in_person_vote) do
on(:ok) do
message_type = in_person_vote.accepted? ? :notice : :alert
flash[message_type] = I18n.t("in_person_votes.update.success.#{in_person_vote.status}", scope: "decidim.votings.polling_officer_zone")
end
on(:invalid) do
flash[:alert] = I18n.t("in_person_votes.update.error", scope: "decidim.votings.polling_officer_zone")
end
end
redirect_to exit_path
end
|