Sha256: e596927605cc198308c75c067c682b665cfe9429817b63f9402baafcb0dc3c17

Contents?: true

Size: 1.16 KB

Versions: 2

Compression:

Stored size: 1.16 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).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

2 entries across 2 versions & 1 rubygems

Version Path
decidim-participatory_processes-0.18.1 app/controllers/decidim/participatory_processes/participatory_process_groups_controller.rb
decidim-participatory_processes-0.18.0 app/controllers/decidim/participatory_processes/participatory_process_groups_controller.rb