Class: Decidim::Kids::Admin::SaveParticipatorySpaceConfig

Inherits:
Command
  • Object
show all
Defined in:
app/commands/decidim/kids/admin/save_participatory_space_config.rb

Overview

A command to save the participatory space minor configuration.

Instance Method Summary collapse

Constructor Details

#initialize(form, participatory_space) ⇒ SaveParticipatorySpaceConfig

Returns a new instance of SaveParticipatorySpaceConfig.



8
9
10
11
# File 'app/commands/decidim/kids/admin/save_participatory_space_config.rb', line 8

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

Instance Method Details

#callObject



13
14
15
16
17
18
19
20
# File 'app/commands/decidim/kids/admin/save_participatory_space_config.rb', line 13

def call
  return broadcast(:invalid) if participatory_space.blank?
  return broadcast(:invalid) if form.invalid?

  save_config

  broadcast(:ok)
end