Sha256: ad8ba8cbbe735c5781b1e08a260608bef938e2d04d3762993cd945b86faa317c

Contents?: true

Size: 1007 Bytes

Versions: 6

Compression:

Stored size: 1007 Bytes

Contents

# frozen_string_literal: true

module Decidim
  module ParticipatoryProcesses
    module Admin
      # A command with all the business logic when creating a new participatory
      # process group in the system.
      class CreateParticipatoryProcessGroup < Decidim::Commands::CreateResource
        fetch_file_attributes :hero_image

        fetch_form_attributes :organization, :title, :description, :hashtag, :group_url, :target, :promoted,
                              :developer_group, :local_area, :meta_scope, :participatory_scope, :participatory_structure

        protected

        def run_after_hooks
          Decidim::ContentBlocksCreator.new(resource).create_default!
        end

        def resource_class = Decidim::ParticipatoryProcessGroup

        def attributes
          super.merge({ participatory_processes: })
        end

        def participatory_processes
          Decidim::ParticipatoryProcess.where(id: form.participatory_process_ids)
        end
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
decidim-participatory_processes-0.29.1 app/commands/decidim/participatory_processes/admin/create_participatory_process_group.rb
decidim-participatory_processes-0.29.0 app/commands/decidim/participatory_processes/admin/create_participatory_process_group.rb
decidim-participatory_processes-0.29.0.rc4 app/commands/decidim/participatory_processes/admin/create_participatory_process_group.rb
decidim-participatory_processes-0.29.0.rc3 app/commands/decidim/participatory_processes/admin/create_participatory_process_group.rb
decidim-participatory_processes-0.29.0.rc2 app/commands/decidim/participatory_processes/admin/create_participatory_process_group.rb
decidim-participatory_processes-0.29.0.rc1 app/commands/decidim/participatory_processes/admin/create_participatory_process_group.rb