Class: Decidim::Admin::CreateFeature
- Inherits:
-
Rectify::Command
- Object
- Rectify::Command
- Decidim::Admin::CreateFeature
- Defined in:
- decidim-admin/app/commands/decidim/admin/create_feature.rb
Overview
This command gets called when a feature is created from the admin panel.
Instance Attribute Summary collapse
-
#form ⇒ Object
readonly
Returns the value of attribute form.
-
#manifest ⇒ Object
readonly
Returns the value of attribute manifest.
-
#participatory_process ⇒ Object
readonly
Returns the value of attribute participatory_process.
Instance Method Summary collapse
-
#call ⇒ Object
Public: Creates the Feature.
-
#initialize(manifest, form, participatory_process) ⇒ CreateFeature
constructor
Public: Initializes the command.
Constructor Details
#initialize(manifest, form, participatory_process) ⇒ CreateFeature
Public: Initializes the command.
manifest - The feature’s manifest to create a feature from. form - The form from which the data in this feature comes from. participatory_process - The participatory process that will hold this feature.
14 15 16 17 18 |
# File 'decidim-admin/app/commands/decidim/admin/create_feature.rb', line 14 def initialize(manifest, form, participatory_process) @manifest = manifest @form = form @participatory_process = participatory_process end |
Instance Attribute Details
#form ⇒ Object (readonly)
Returns the value of attribute form.
7 8 9 |
# File 'decidim-admin/app/commands/decidim/admin/create_feature.rb', line 7 def form @form end |
#manifest ⇒ Object (readonly)
Returns the value of attribute manifest.
7 8 9 |
# File 'decidim-admin/app/commands/decidim/admin/create_feature.rb', line 7 def manifest @manifest end |
#participatory_process ⇒ Object (readonly)
Returns the value of attribute participatory_process.
7 8 9 |
# File 'decidim-admin/app/commands/decidim/admin/create_feature.rb', line 7 def participatory_process @participatory_process end |
Instance Method Details
#call ⇒ Object
Public: Creates the Feature.
Broadcasts :ok if created, :invalid otherwise.
23 24 25 26 27 28 29 30 31 32 |
# File 'decidim-admin/app/commands/decidim/admin/create_feature.rb', line 23 def call return broadcast(:invalid) if form.invalid? transaction do create_feature run_hooks end broadcast(:ok) end |