Sha256: 49ddba9590ce4ec0bcf5f0e916ddfa869eab53164c537e445affd61401453ae5

Contents?: true

Size: 1.11 KB

Versions: 13

Compression:

Stored size: 1.11 KB

Contents

# frozen_string_literal: true

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

      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).published
                                     else
                                       group.participatory_processes.published.public_spaces
                                     end
      end

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

      attr_reader :group
    end
  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
decidim-participatory_processes-0.25.2 app/controllers/decidim/participatory_processes/participatory_process_groups_controller.rb
decidim-participatory_processes-0.25.1 app/controllers/decidim/participatory_processes/participatory_process_groups_controller.rb
decidim-participatory_processes-0.25.0 app/controllers/decidim/participatory_processes/participatory_process_groups_controller.rb
decidim-participatory_processes-0.25.0.rc4 app/controllers/decidim/participatory_processes/participatory_process_groups_controller.rb
decidim-participatory_processes-0.25.0.rc3 app/controllers/decidim/participatory_processes/participatory_process_groups_controller.rb
decidim-participatory_processes-0.25.0.rc2 app/controllers/decidim/participatory_processes/participatory_process_groups_controller.rb
decidim-participatory_processes-0.25.0.rc1 app/controllers/decidim/participatory_processes/participatory_process_groups_controller.rb
decidim-participatory_processes-0.24.3 app/controllers/decidim/participatory_processes/participatory_process_groups_controller.rb
decidim-participatory_processes-0.24.2 app/controllers/decidim/participatory_processes/participatory_process_groups_controller.rb
decidim-participatory_processes-0.24.1 app/controllers/decidim/participatory_processes/participatory_process_groups_controller.rb
decidim-participatory_processes-0.24.0 app/controllers/decidim/participatory_processes/participatory_process_groups_controller.rb
decidim-participatory_processes-0.24.0.rc2 app/controllers/decidim/participatory_processes/participatory_process_groups_controller.rb
decidim-participatory_processes-0.24.0.rc1 app/controllers/decidim/participatory_processes/participatory_process_groups_controller.rb