Class: Decidim::ActionDelegator::Admin::ManageParticipantsController
- Inherits:
-
ApplicationController
- Object
- Decidim::Admin::ApplicationController
- ApplicationController
- Decidim::ActionDelegator::Admin::ManageParticipantsController
show all
- Includes:
- Paginable, NeedsPermission
- Defined in:
- app/controllers/decidim/action_delegator/admin/manage_participants_controller.rb
Instance Method Summary
collapse
#current_setting, #organization_settings, #permission_class_chain
Instance Method Details
#create ⇒ Object
22
23
24
25
26
27
28
29
30
31
32
33
34
35
|
# File 'app/controllers/decidim/action_delegator/admin/manage_participants_controller.rb', line 22
def create
enforce_permission_to :create, :participant
@form = CsvImportForm.from_params(params)
if @form.valid?
csv = @form.csv_file.download.force_encoding("utf-8").encode("utf-8")
@import_summary = ImportCsvJob.perform_now("ParticipantsCsvImporter", csv, current_user, current_setting)
flash[:notice] = t(".success")
redirect_to setting_participants_path(current_setting)
else
render :new
end
end
|
#destroy_all ⇒ Object
37
38
39
40
41
42
43
44
45
46
|
# File 'app/controllers/decidim/action_delegator/admin/manage_participants_controller.rb', line 37
def destroy_all
enforce_permission_to :destroy, :participant, { resource: current_setting }
participants_to_remove = current_setting.participants.reject(&:voted?)
participants_to_remove.each(&:destroy)
flash[:notice] = I18n.t("participants.remove_census.success", scope: "decidim.action_delegator.admin", participants_count: participants_to_remove.count)
redirect_to setting_participants_path(current_setting)
end
|
#new ⇒ Object
15
16
17
18
19
20
|
# File 'app/controllers/decidim/action_delegator/admin/manage_participants_controller.rb', line 15
def new
enforce_permission_to :create, :participant
@form = CsvImportForm.from_params(params)
@errors = []
end
|