Sha256: ba5c0fe2301e8d2d01d5930974fdb536f57cc962e88a72d09b75083b6fef886c
Contents?: true
Size: 1.25 KB
Versions: 2
Compression:
Stored size: 1.25 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 CreateParticipatoryProcess < Rectify::Command # Public: Initializes the command. # # form - A form object with the params. # organization - The Organization of the user that created the # participatory process def initialize(form, organization) @form = form @organization = organization end # Executes the command. Braodcasts 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? create_participatory_process broadcast(:ok) end private attr_reader :form def create_participatory_process ParticipatoryProcess.create!( title: form.title, subtitle: form.subtitle, slug: form.slug, hashtag: form.hashtag, description: form.description, short_description: form.short_description, organization: @organization ) end end end end
Version data entries
2 entries across 2 versions & 2 rubygems
Version | Path |
---|---|
decidim-admin-0.0.1.alpha5 | app/commands/decidim/admin/create_participatory_process.rb |
decidim-0.0.1.alpha5 | decidim-admin/app/commands/decidim/admin/create_participatory_process.rb |