Class: Decidim::Proposals::Admin::CreateProposalNote
- Includes:
- ProposalNotesMethods
- Defined in:
- decidim-proposals/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.
Methods inherited from Command
call, #evaluate, #method_missing, #respond_to_missing?, #transaction, #with_events
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 'decidim-proposals/app/commands/decidim/proposals/admin/create_proposal_note.rb', line 14 def initialize(form, proposal) @form = form @proposal = proposal end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class Decidim::Command
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 'decidim-proposals/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_evaluators broadcast(:ok, proposal_note) end |