Class: Decidim::DecidimAwesome::Admin::CreateScopedStyle

Inherits:
Command
  • Object
show all
Includes:
NeedsConstraintHelpers
Defined in:
app/commands/decidim/decidim_awesome/admin/create_scoped_style.rb

Instance Method Summary collapse

Constructor Details

#initialize(organization, config_var = :scoped_styles) ⇒ CreateScopedStyle

Public: Initializes the command.



10
11
12
13
# File 'app/commands/decidim/decidim_awesome/admin/create_scoped_style.rb', line 10

def initialize(organization, config_var = :scoped_styles)
  @organization = organization
  @config_var = config_var
end

Instance Method Details

#callObject

Executes the command. Broadcasts these events:

  • :ok when everything is valid.

  • :invalid if we couldn’t proceed.

Returns nothing.



21
22
23
24
25
26
27
# File 'app/commands/decidim/decidim_awesome/admin/create_scoped_style.rb', line 21

def call
  create_hash_config!("")

  broadcast(:ok, ident)
rescue StandardError => e
  broadcast(:invalid, e.message)
end