Sha256: 29b3c1d48c1df4c80c8734dff98d66e1c08a939e2df9ee4d782e9d3750771421
Contents?: true
Size: 1.4 KB
Versions: 4
Compression:
Stored size: 1.4 KB
Contents
# frozen_string_literal: true module Decidim module Admin # A command with all the business logic when creating a new participatory # process in the system. class UpdateParticipatoryProcess < Rectify::Command # Public: Initializes the command. # # participatory_process - the ParticipatoryProcess to update # form - A form object with the params. def initialize(participatory_process, form) @participatory_process = participatory_process @form = form end # Executes the command. Broadcasts these events: # # - :ok when everything is valid. # - :invalid if the form wasn't valid and we couldn't proceed. # # Returns nothing. def call return broadcast(:invalid) if form.invalid? update_participatory_process broadcast(:ok) end private attr_reader :form def update_participatory_process @participatory_process.update_attributes!(attributes) end def attributes { title: form.title, subtitle: form.subtitle, slug: form.slug, hashtag: form.hashtag, hero_image: form.hero_image, banner_image: form.banner_image, promoted: form.promoted, description: form.description, short_description: form.short_description }.compact end end end end
Version data entries
4 entries across 4 versions & 2 rubygems