Class: Decidim::TermCustomizer::Admin::UpdateTranslationSet

Inherits:
Rectify::Command
  • Object
show all
Defined in:
app/commands/decidim/term_customizer/admin/update_translation_set.rb

Overview

This command is executed when the user changes a translation set from the admin panel.

Instance Method Summary collapse

Constructor Details

#initialize(form, set) ⇒ UpdateTranslationSet

Initializes a UpdateTranslationSet Command.

form - The form from which to get the data. set - The current instance of the translation set to be updated.



13
14
15
16
# File 'app/commands/decidim/term_customizer/admin/update_translation_set.rb', line 13

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

Instance Method Details

#callObject

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/update_translation_set.rb', line 21

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

  transaction do
    update_translation_set!
  end

  broadcast(:ok, set)
end