Class: Decidim::EnhancedTextwork::Admin::CreateParagraphNote
- Inherits:
-
Rectify::Command
- Object
- Rectify::Command
- Decidim::EnhancedTextwork::Admin::CreateParagraphNote
- Defined in:
- app/commands/decidim/enhanced_textwork/admin/create_paragraph_note.rb
Overview
A command with all the business logic when an admin creates a private note paragraph.
Instance Method Summary collapse
-
#call ⇒ Object
Executes the command.
-
#initialize(form, paragraph) ⇒ CreateParagraphNote
constructor
Public: Initializes the command.
Constructor Details
#initialize(form, paragraph) ⇒ CreateParagraphNote
Public: Initializes the command.
form - A form object with the params. paragraph - the paragraph to relate.
12 13 14 15 |
# File 'app/commands/decidim/enhanced_textwork/admin/create_paragraph_note.rb', line 12 def initialize(form, paragraph) @form = form @paragraph = paragraph end |
Instance Method Details
#call ⇒ Object
Executes the command. Broadcasts these events:
-
:ok when everything is valid, together with the note paragraph.
-
:invalid if the form wasn't valid and we couldn't proceed.
Returns nothing.
23 24 25 26 27 28 29 30 |
# File 'app/commands/decidim/enhanced_textwork/admin/create_paragraph_note.rb', line 23 def call return broadcast(:invalid) if form.invalid? create_paragraph_note notify_admins_and_valuators broadcast(:ok, paragraph_note) end |