Class: Decidim::TermCustomizer::Admin::DuplicateTranslationSet
- Inherits:
-
Rectify::Command
- Object
- Rectify::Command
- Decidim::TermCustomizer::Admin::DuplicateTranslationSet
- Defined in:
- app/commands/decidim/term_customizer/admin/duplicate_translation_set.rb
Overview
This command is executed when the user duplicates a translation set from the admin panel.
Instance Method Summary collapse
-
#call ⇒ Object
Updates the blog if valid.
-
#initialize(form, set) ⇒ DuplicateTranslationSet
constructor
Initializes a DuplicateTranslationSet Command.
Constructor Details
#initialize(form, set) ⇒ DuplicateTranslationSet
Initializes a DuplicateTranslationSet Command.
form - A form object with the params. set - The instance of the translation set to be duplicated.
13 14 15 16 |
# File 'app/commands/decidim/term_customizer/admin/duplicate_translation_set.rb', line 13 def initialize(form, set) @form = form @set = set end |
Instance Method Details
#call ⇒ Object
Updates the blog if valid.
Broadcasts :ok if successful, :invalid otherwise.
21 22 23 24 25 26 27 28 29 |
# File 'app/commands/decidim/term_customizer/admin/duplicate_translation_set.rb', line 21 def call return broadcast(:invalid) if form.invalid? transaction do duplicate_translation_set! end broadcast(:ok, set) end |