Sha256: e4e3ad300801759c9b504f775fcdad9f4e22b4f06fcc48449bf89fee05b453f1

Contents?: true

Size: 800 Bytes

Versions: 5

Compression:

Stored size: 800 Bytes

Contents

# frozen_string_literal: true

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

      included do
        def proposals
          @proposals ||= begin
            proposals_query = Decidim.find_resource_manifest(:proposals).try(:resource_scope, component)
            reporting_proposals_query = Decidim.find_resource_manifest(:reporting_proposals).try(:resource_scope, component)
            (reporting_proposals_query ? proposals_query.or(reporting_proposals_query) : proposals_query)
             &.includes(:component)
             &.published
             &.not_hidden
             &.order(id: :asc)
          end
        end
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
decidim-reporting_proposals-0.6.0 app/cells/concerns/decidim/reporting_proposals/proposals_picker_cell_override.rb
decidim-reporting_proposals-0.5.2 app/cells/concerns/decidim/reporting_proposals/proposals_picker_cell_override.rb
decidim-reporting_proposals-0.5.1 app/cells/concerns/decidim/reporting_proposals/proposals_picker_cell_override.rb
decidim-reporting_proposals-0.5.0 app/cells/concerns/decidim/reporting_proposals/proposals_picker_cell_override.rb
decidim-reporting_proposals-0.4.2 app/cells/concerns/decidim/reporting_proposals/proposals_picker_cell_override.rb