Sha256: 780ff5b37050687f79f027bd6b519593b8d9be633521f3bbfcc854a99a3c00dd
Contents?: true
Size: 951 Bytes
Versions: 5
Compression:
Stored size: 951 Bytes
Contents
# frozen_string_literal: true module Decidim module ReportingProposals module MapIncludedProposalsForFormOverride extend ActiveSupport::Concern included do alias_method :map_model_original, :map_model def map_model(model) map_model_original(model) self.proposal_ids += model.linked_resources(:reporting_proposals, "included_proposals").pluck(:id) end def proposals @proposals ||= begin proposals_query = Decidim.find_resource_manifest(:proposals).try(:resource_scope, current_component) reporting_proposals_query = Decidim.find_resource_manifest(:reporting_proposals).try(:resource_scope, current_component) (reporting_proposals_query ? proposals_query.or(reporting_proposals_query) : proposals_query) &.where(id: proposal_ids) &.order(title: :asc) end end end end end end
Version data entries
5 entries across 5 versions & 1 rubygems