Class: Decidim::Conferences::Admin::UpdateDiploma
- Inherits:
-
Decidim::Command
- Object
- Decidim::Command
- Decidim::Conferences::Admin::UpdateDiploma
- Defined in:
- decidim-conferences/app/commands/decidim/conferences/admin/update_diploma.rb
Overview
This command is executed when the user updates the conference diploma configuration.
Instance Method Summary collapse
-
#call ⇒ Object
Updates the conference if valid.
-
#initialize(form, conference) ⇒ UpdateDiploma
constructor
Initializes a UpdateDiploma Command.
Methods inherited from Decidim::Command
call, #evaluate, #method_missing, #respond_to_missing?, #transaction, #with_events
Constructor Details
#initialize(form, conference) ⇒ UpdateDiploma
Initializes a UpdateDiploma Command.
form - The form from which to get the data. conference - The current instance of the conference to be updated.
12 13 14 15 |
# File 'decidim-conferences/app/commands/decidim/conferences/admin/update_diploma.rb', line 12 def initialize(form, conference) @form = form @conference = conference end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class Decidim::Command
Instance Method Details
#call ⇒ Object
Updates the conference if valid.
Broadcasts :ok if successful, :invalid otherwise.
20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'decidim-conferences/app/commands/decidim/conferences/admin/update_diploma.rb', line 20 def call return broadcast(:invalid) if form.invalid? @conference.with_lock do update_conference_diploma Decidim.traceability.perform_action!(:update_diploma, @conference, form.current_user) do @conference end end broadcast(:ok) end |