Class: Decidim::Admin::ContentBlocks::CreateContentBlock
- Inherits:
- 
      Command
      
        - Object
- Command
- Decidim::Admin::ContentBlocks::CreateContentBlock
 
- Defined in:
- app/commands/decidim/admin/content_blocks/create_content_block.rb
Overview
A command that reorders a collection of content blocks. It also creates the ones that might be missing.
Instance Method Summary collapse
- 
  
    
      #call  ⇒ Object 
    
    
  
  
  
  
  
  
  
  
  
    Executes the command. 
- 
  
    
      #initialize(organization, scope, manifest_name, scoped_resource_id = nil)  ⇒ CreateContentBlock 
    
    
  
  
  
    constructor
  
  
  
  
  
  
  
    Public: Initializes the command. 
Constructor Details
#initialize(organization, scope, manifest_name, scoped_resource_id = nil) ⇒ CreateContentBlock
Public: Initializes the command.
organization - the Organization where the content blocks reside scope - the scope applied to the content blocks manifest_name - the manifest name for the content block created scoped_resource_id - (optional) The id of the resource the content blocks belongs to
| 15 16 17 18 19 20 | # File 'app/commands/decidim/admin/content_blocks/create_content_block.rb', line 15 def initialize(organization, scope, manifest_name, scoped_resource_id = nil) @organization = organization @scope = scope @manifest_name = manifest_name @scoped_resource_id = scoped_resource_id end | 
Instance Method Details
#call ⇒ Object
Executes the command. Broadcasts these events:
- 
:ok when everything is valid. 
- 
:invalid if the data was not valid and we could not proceed. 
Returns nothing.
| 28 29 30 31 32 33 | # File 'app/commands/decidim/admin/content_blocks/create_content_block.rb', line 28 def call create_content_block broadcast(:ok) rescue StandardError broadcast(:invalid) end |