Sha256: 6517e8673c8f3280b9d7b6e4409cb9a1da9cf181e6b322319503a0ac117cf22c
Contents?: true
Size: 1.86 KB
Versions: 18
Compression:
Stored size: 1.86 KB
Contents
# frozen_string_literal: true module Decidim module ParticipatoryProcesses # A controller that holds the logic to show ParticipatoryProcesses in a # public layout. class ParticipatoryProcessesController < Decidim::ApplicationController layout "layouts/decidim/participatory_process", only: [:show] before_action -> { extend NeedsParticipatoryProcess }, only: [:show] helper Decidim::AttachmentsHelper helper Decidim::IconHelper helper Decidim::WidgetUrlsHelper helper ParticipatoryProcessHelper helper_method :collection, :promoted_participatory_processes, :participatory_processes, :stats, :filter def index authorize! :read, ParticipatoryProcess authorize! :read, ParticipatoryProcessGroup end def show authorize! :read, current_participatory_process end private def collection @collection ||= (participatory_processes.to_a + participatory_process_groups).flatten end def filtered_participatory_processes(filter = default_filter) OrganizationPrioritizedParticipatoryProcesses.new(current_organization, filter) end def participatory_processes @participatory_processes ||= filtered_participatory_processes(filter) end def promoted_participatory_processes @promoted_processes ||= filtered_participatory_processes | PromotedParticipatoryProcesses.new end def participatory_process_groups @process_groups ||= OrganizationPrioritizedParticipatoryProcessGroups.new(current_organization, filter) end def stats @stats ||= ParticipatoryProcessStatsPresenter.new(participatory_process: current_participatory_process) end def filter @filter = params[:filter] || default_filter end def default_filter "active" end end end end
Version data entries
18 entries across 18 versions & 2 rubygems