Class: Decidim::ParticipatoryProcesses::Admin::ReorderParticipatoryProcessSteps
- Inherits:
-
Command
- Object
- Command
- Decidim::ParticipatoryProcesses::Admin::ReorderParticipatoryProcessSteps
- Defined in:
- app/commands/decidim/participatory_processes/admin/reorder_participatory_process_steps.rb
Overview
A command that reorders the steps in a participatory process.
Instance Method Summary collapse
-
#call ⇒ Object
Executes the command.
-
#initialize(collection, order) ⇒ ReorderParticipatoryProcessSteps
constructor
Public: Initializes the command.
Constructor Details
#initialize(collection, order) ⇒ ReorderParticipatoryProcessSteps
Public: Initializes the command.
collection - an ActiveRecord::Relation of steps order - an Array holding the order of IDs of steps
12 13 14 15 |
# File 'app/commands/decidim/participatory_processes/admin/reorder_participatory_process_steps.rb', line 12 def initialize(collection, order) @collection = collection @order = order 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.
23 24 25 26 27 28 |
# File 'app/commands/decidim/participatory_processes/admin/reorder_participatory_process_steps.rb', line 23 def call return broadcast(:invalid) if order.blank? reorder_steps broadcast(:ok) end |