Sha256: c5f519811743a634ff0ace109f6021034aa2c5d45daa847fe302247b5c5d49a5
Contents?: true
Size: 1.91 KB
Versions: 7
Compression:
Stored size: 1.91 KB
Contents
# frozen_string_literal: true module Decidim module ParticipatoryProcesses module ContentBlocks class HighlightedProcessesCell < Decidim::ContentBlocks::HighlightedParticipatorySpacesCell delegate :current_user, to: :controller def highlighted_spaces @highlighted_spaces ||= promoted_groups + highlighted_processes end alias limited_highlighted_spaces highlighted_spaces def i18n_scope "decidim.participatory_processes.pages.home.highlighted_processes" end def all_path Decidim::ParticipatoryProcesses::Engine.routes.url_helpers.participatory_processes_path end def max_results model.settings.max_results end private def block_id "highlighted-processes" end def highlighted_processes @highlighted_processes ||= if highlighted_processes_max_results.zero? [] else ( OrganizationPublishedParticipatoryProcesses.new(current_organization, current_user) | HighlightedParticipatoryProcesses.new | FilteredParticipatoryProcesses.new("active") ).query.with_attached_hero_image.includes([:organization, :hero_image_attachment]).limit(highlighted_processes_max_results) end end def promoted_groups @promoted_groups ||= (OrganizationParticipatoryProcessGroups.new(current_organization) | PromotedParticipatoryProcessGroups.new).query.limit(max_results) end def highlighted_processes_max_results @highlighted_processes_max_results ||= max_results - promoted_groups.count end end end end end
Version data entries
7 entries across 7 versions & 1 rubygems