class Decidim::Pages::Admin::UpdatePage

panel.
This command is executed when the user changes a Page from the admin

def call

Broadcasts :ok if successful, :invalid otherwise.

Updates the page if valid.
def call
  return broadcast(:invalid) if @form.invalid?
  update_page
  broadcast(:ok)
end

def initialize(form, page)

page - The current instance of the page to be updated.
form - The form from which to get the data.

Initializes a UpdatePage Command.
def initialize(form, page)
  @form = form
  @page = page
end

def update_page

def update_page
  Decidim.traceability.update!(
    @page,
    @form.current_user,
    body: @form.body
  )
end