Sha256: 9ebdb399fca3fe8ae9d77977903660e2bd339943973cffccb1253e2a56e9b085

Contents?: true

Size: 929 Bytes

Versions: 4

Compression:

Stored size: 929 Bytes

Contents

# frozen_string_literal: true

module Decidim
  module ReportingProposals
    module Admin
      # Exposes the proposal resource so users can view and create them.
      module ProposalsControllerOverride
        extend ActiveSupport::Concern

        included do
          helper_method :reporting_proposal?, :proposals, :query, :form_presenter, :proposal, :proposal_ids
          def show
            @notes_form = form(Decidim::Proposals::Admin::ProposalNoteForm).instance
            @answer_form = form(Decidim::Proposals::Admin::ProposalAnswerForm).from_model(proposal)
            @photo_form = form(Decidim::ReportingProposals::Admin::ProposalPhotoForm).instance
          end

          private

          def reporting_proposal?
            component = current_component || @photo_form.current_component
            component.manifest_name == "reporting_proposals"
          end
        end
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
decidim-reporting_proposals-0.5.1 app/controllers/concerns/decidim/reporting_proposals/admin/proposals_controller_override.rb
decidim-reporting_proposals-0.5.0 app/controllers/concerns/decidim/reporting_proposals/admin/proposals_controller_override.rb
decidim-reporting_proposals-0.4.2 app/controllers/concerns/decidim/reporting_proposals/admin/proposals_controller_override.rb
decidim-reporting_proposals-0.2.0 app/controllers/concerns/decidim/reporting_proposals/admin/proposals_controller_override.rb