Sha256: 8533466cbc537b4c46dcb6ca466aa83a564c2992530585802ec94f81209b1fce

Contents?: true

Size: 1.17 KB

Versions: 3

Compression:

Stored size: 1.17 KB

Contents

# frozen_string_literal: true

module Decidim
  module ParticipatoryProcesses
    class ParticipatoryProcessGroupsController < Decidim::ParticipatoryProcesses::ApplicationController
      helper Decidim::SanitizeHelper
      helper_method :participatory_processes, :group, :collection

      before_action :set_group

      def index
        enforce_permission_to :list, :process_group
      end

      def show
        enforce_permission_to :read, :process_group, process_group: @group
      end

      private

      def participatory_processes
        @participatory_processes ||= if current_user
                                       return group.participatory_processes.published if current_user.admin
                                       group.participatory_processes.visible_for(current_user.id).published
                                     else
                                       group.participatory_processes.published.public_spaces
                                     end
      end
      alias collection participatory_processes

      def set_group
        @group = Decidim::ParticipatoryProcessGroup.find(params[:id])
      end

      attr_reader :group
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
decidim-participatory_processes-0.17.2 app/controllers/decidim/participatory_processes/participatory_process_groups_controller.rb
decidim-participatory_processes-0.17.1 app/controllers/decidim/participatory_processes/participatory_process_groups_controller.rb
decidim-participatory_processes-0.17.0 app/controllers/decidim/participatory_processes/participatory_process_groups_controller.rb