Sha256: 8612f3c485e91b9d8e8ff135e05b7fca099e71a8c5d4a3edd5c20dbad57c8f96
Contents?: true
Size: 932 Bytes
Versions: 30
Compression:
Stored size: 932 Bytes
Contents
# frozen_string_literal: true module Decidim module Pages module Admin # This command is executed when the user changes a Page from the admin # panel. class UpdatePage < Decidim::Command # Initializes a UpdatePage Command. # # form - The form from which to get the data. # page - The current instance of the page to be updated. def initialize(form, page) @form = form @page = page end # Updates the page if valid. # # Broadcasts :ok if successful, :invalid otherwise. def call return broadcast(:invalid) if @form.invalid? update_page broadcast(:ok) end private def update_page Decidim.traceability.update!( @page, @form.current_user, body: @form.body ) end end end end end
Version data entries
30 entries across 30 versions & 1 rubygems