Class: Decidim::Admin::ParticipatorySpace::ImportMemberCsv

Inherits:
Command
  • Object
show all
Includes:
CustomImport
Defined in:
app/commands/decidim/admin/participatory_space/import_member_csv.rb

Instance Method Summary collapse

Constructor Details

#initialize(form, members_to) ⇒ ImportMemberCsv

Public: Initializes the command.

form - the form object containing the uploaded file members_to - The members_to that will hold the user role



16
17
18
19
# File 'app/commands/decidim/admin/participatory_space/import_member_csv.rb', line 16

def initialize(form, members_to)
  @form = form
  @members_to = members_to
end

Instance Method Details

#callObject

Executes the command. Broadcasts these events:

  • :ok when everything is valid.

  • :invalid if the form was not valid and we could not proceed.

Returns nothing.



27
28
29
30
31
32
# File 'app/commands/decidim/admin/participatory_space/import_member_csv.rb', line 27

def call
  return broadcast(:invalid) unless @form.valid?

  process_csv
  broadcast(:ok)
end