Class: Decidim::Proposals::Admin::CreateProposalNote
- Inherits:
-
Command
- Object
- Command
- Decidim::Proposals::Admin::CreateProposalNote
- Includes:
- ProposalNotesMethods
- Defined in:
- app/commands/decidim/proposals/admin/create_proposal_note.rb
Overview
A command with all the business logic when an admin creates a private note proposal.
Instance Method Summary collapse
-
#call ⇒ Object
Executes the command.
-
#initialize(form, proposal) ⇒ CreateProposalNote
constructor
Public: Initializes the command.
Constructor Details
#initialize(form, proposal) ⇒ CreateProposalNote
Public: Initializes the command.
form - A form object with the params. proposal - the proposal to relate.
14 15 16 17 |
# File 'app/commands/decidim/proposals/admin/create_proposal_note.rb', line 14 def initialize(form, proposal) @form = form @proposal = proposal end |
Instance Method Details
#call ⇒ Object
Executes the command. Broadcasts these events:
-
:ok when everything is valid, together with the note proposal.
-
:invalid if the form was not valid and we could not proceed.
Returns nothing.
25 26 27 28 29 30 31 32 33 |
# File 'app/commands/decidim/proposals/admin/create_proposal_note.rb', line 25 def call return broadcast(:invalid) if form.invalid? create_proposal_note notify_mentioned notify_not_mentioned_valuators broadcast(:ok, proposal_note) end |