Sha256: 98b83655290f814f3b98d73d3ce3313ee50d977666ce7fb10d323822a4b4dfda

Contents?: true

Size: 1.09 KB

Versions: 6

Compression:

Stored size: 1.09 KB

Contents

# frozen_string_literal: true

module Decidim
  module Accountability
    module Admin
      # This command is executed when the user creates a Result from the admin
      # panel using the "Import results from CSV file" feature
      class CreateImportedResult < Decidim::Commands::CreateResource
        include Decidim::Accountability::Admin::HasResultCommand

        fetch_form_attributes :scope, :component, :category, :parent_id, :title, :description, :start_date,
                              :end_date, :progress, :decidim_accountability_status_id, :external_id, :weight

        def initialize(form, parent_id = nil)
          super(form)
          @parent_id = parent_id
        end

        private

        attr_reader :parent_id
        alias result resource

        def resource_class = Decidim::Accountability::Result

        def extra_params = { visibility: "all" }

        def attributes = super.merge(parent_id:)

        def run_after_hooks
          link_meetings
          link_proposals
          link_projects
          notify_proposal_followers
        end
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

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