Class: Decidim::Conferences::Admin::UnpublishRegistrationType
- Inherits:
 - 
      Decidim::Command
      
        
- Object
 - Decidim::Command
 - Decidim::Conferences::Admin::UnpublishRegistrationType
 
 
- Defined in:
 - app/commands/decidim/conferences/admin/unpublish_registration_type.rb
 
Overview
This command gets called when a registration type is unpublished from the admin panel.
Instance Method Summary collapse
- 
  
    
      #call  ⇒ Object 
    
    
  
  
  
  
  
  
  
  
  
    
Public: Unpublishes the RegistrationType.
 - 
  
    
      #initialize(registration_type, current_user)  ⇒ UnpublishRegistrationType 
    
    
  
  
  
    constructor
  
  
  
  
  
  
  
    
Public: Initializes the command.
 
Constructor Details
#initialize(registration_type, current_user) ⇒ UnpublishRegistrationType
Public: Initializes the command.
registration_type - The registration_type to unpublish. current_user - the user performing the action
      12 13 14 15  | 
    
      # File 'app/commands/decidim/conferences/admin/unpublish_registration_type.rb', line 12 def initialize(registration_type, current_user) @registration_type = registration_type @current_user = current_user end  | 
  
Instance Method Details
#call ⇒ Object
Public: Unpublishes the RegistrationType.
Broadcasts :ok if unpublished, :invalid otherwise.
      20 21 22 23 24 25 26 27 28  | 
    
      # File 'app/commands/decidim/conferences/admin/unpublish_registration_type.rb', line 20 def call return broadcast(:invalid) if registration_type.nil? || !registration_type.published? Decidim.traceability.perform_action!(:unpublish, registration_type, current_user) do registration_type.unpublish! end broadcast(:ok) end  |