Sha256: 7f8878bbfcc79c48d41c9007473c037ae9880db3f3cb28249dd05dcc3ac4b4b8

Contents?: true

Size: 639 Bytes

Versions: 6

Compression:

Stored size: 639 Bytes

Contents

# frozen_string_literal: true

module Decidim
  module Admin
    # This command gets called when a component is created from the admin panel.
    class CreateComponent < Decidim::Commands::CreateResource
      fetch_form_attributes :name, :participatory_space, :weight, :settings, :default_step_settings, :step_settings

      private

      # Use `reverse_merge` instead of `merge` as we need the `manifest_name` first
      def attributes = super.reverse_merge({ manifest_name: form.manifest.name })

      def resource_class = Decidim::Component

      def run_after_hooks = form.manifest.run_hooks(:create, resource)
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

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