Class: Decidim::Meetings::Admin::UpdateAgenda

Inherits:
Rectify::Command
  • Object
show all
Defined in:
decidim-meetings/app/commands/decidim/meetings/admin/update_agenda.rb

Overview

This command is executed when the user creates a Meeting from the admin panel.

Instance Method Summary collapse

Constructor Details

#initialize(form, agenda) ⇒ UpdateAgenda

Returns a new instance of UpdateAgenda.


9
10
11
12
# File 'decidim-meetings/app/commands/decidim/meetings/admin/update_agenda.rb', line 9

def initialize(form, agenda)
  @form = form
  @agenda = agenda
end

Instance Method Details

#callObject

Creates the agenda if valid.

Broadcasts :ok if successful, :invalid otherwise.


17
18
19
20
21
22
23
24
25
26
# File 'decidim-meetings/app/commands/decidim/meetings/admin/update_agenda.rb', line 17

def call
  return broadcast(:invalid) if @form.invalid?

  transaction do
    update_agenda!
    update_agenda_items
  end

  broadcast(:ok, @agenda)
end