Class: Decidim::Conferences::Admin::PublishRegistrationType
- Inherits:
-
Decidim::Command
- Object
- Decidim::Command
- Decidim::Conferences::Admin::PublishRegistrationType
- Defined in:
- decidim-conferences/app/commands/decidim/conferences/admin/publish_registration_type.rb
Overview
This command gets called when a registration_type is published from the admin panel.
Instance Method Summary collapse
-
#call ⇒ Object
Public: Publishes the Component.
-
#initialize(registration_type, current_user) ⇒ PublishRegistrationType
constructor
Public: Initializes the command.
Methods inherited from Decidim::Command
call, #evaluate, #method_missing, #respond_to_missing?, #transaction, #with_events
Constructor Details
#initialize(registration_type, current_user) ⇒ PublishRegistrationType
Public: Initializes the command.
registration_type - The registration_type to publish. current_user - the user performing the action
12 13 14 15 |
# File 'decidim-conferences/app/commands/decidim/conferences/admin/publish_registration_type.rb', line 12 def initialize(registration_type, current_user) @registration_type = registration_type @current_user = current_user end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class Decidim::Command
Instance Method Details
#call ⇒ Object
Public: Publishes the Component.
Broadcasts :ok if published, :invalid otherwise.
20 21 22 23 24 25 26 27 28 |
# File 'decidim-conferences/app/commands/decidim/conferences/admin/publish_registration_type.rb', line 20 def call return broadcast(:invalid) if registration_type.nil? || registration_type.published? Decidim.traceability.perform_action!(:publish, registration_type, current_user) do registration_type.publish! end broadcast(:ok) end |