Sha256: 1bc9be4403847df224ca3a705a12a5aba8f93f104ae633178fa88285ab4d02be

Contents?: true

Size: 803 Bytes

Versions: 1

Compression:

Stored size: 803 Bytes

Contents

# frozen_string_literal: true

module Decidim
  module ReportingProposals
    module Admin
      module UpdateProposalAnswerTemplateOverride
        extend ActiveSupport::Concern

        included do
          private

          def identify_templateable_resource
            resource = @form.current_organization
            if @form.component_constraint.present?
              found_component = Decidim::Component.find_by(id: @form.component_constraint, manifest_name: %w(proposals reporting_proposals))
              if found_component.present?
                resource = found_component&.participatory_space&.decidim_organization_id == @form.current_organization.id ? found_component : nil
              end
            end
            resource
          end
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
decidim-reporting_proposals-0.6.0 app/commands/concerns/decidim/reporting_proposals/admin/update_proposal_answer_template_override.rb