Class: Decidim::TermCustomizer::Admin::UpdateTranslation
- Inherits:
-
Rectify::Command
- Object
- Rectify::Command
- Decidim::TermCustomizer::Admin::UpdateTranslation
- Defined in:
- app/commands/decidim/term_customizer/admin/update_translation.rb
Overview
This command is executed when the user changes a translation from the admin panel.
Instance Method Summary collapse
-
#call ⇒ Object
Executes the command.
-
#initialize(form, translation) ⇒ UpdateTranslation
constructor
Public: Initializes the command.
Constructor Details
#initialize(form, translation) ⇒ UpdateTranslation
Public: Initializes the command.
form - A form object with the params. translation - The current instance of the translation to be updated.
13 14 15 16 |
# File 'app/commands/decidim/term_customizer/admin/update_translation.rb', line 13 def initialize(form, translation) @form = form @translation = translation end |
Instance Method Details
#call ⇒ Object
Executes the command. Broadcasts these events:
-
:ok when everything is valid.
-
:invalid if the form wasn’t valid and we couldn’t proceed.
Returns nothing.
24 25 26 27 28 29 30 31 32 |
# File 'app/commands/decidim/term_customizer/admin/update_translation.rb', line 24 def call return broadcast(:invalid) if form.invalid? transaction do update_translations! end broadcast(:ok, translation) end |