Class: Decidim::ActionDelegator::Admin::ManageDelegationsController

Inherits:
ApplicationController
  • Object
show all
Includes:
Paginable, NeedsPermission
Defined in:
app/controllers/decidim/action_delegator/admin/manage_delegations_controller.rb

Instance Method Summary collapse

Methods inherited from ApplicationController

#permission_class_chain

Instance Method Details

#createObject



21
22
23
24
25
26
27
28
29
30
31
32
33
# File 'app/controllers/decidim/action_delegator/admin/manage_delegations_controller.rb', line 21

def create
  enforce_permission_to :create, :delegation

  @csv_file = params[:csv_file]
  redirect_to(new_setting_manage_delegation_path) && return if @csv_file.blank?

  csv_file = @csv_file.read.force_encoding("utf-8").encode("utf-8")
  @import_summary = Decidim::ActionDelegator::Admin::ImportCsvJob.perform_now("DelegationsCsvImporter", csv_file, current_user, current_setting)

  flash[:notice] = t(".success")

  redirect_to setting_delegations_path(current_setting)
end

#newObject



15
16
17
18
19
# File 'app/controllers/decidim/action_delegator/admin/manage_delegations_controller.rb', line 15

def new
  enforce_permission_to :create, :delegation

  @errors = []
end