Sha256: 0b40d7e9f38a317e3cacc0c28ab6dca84245f69cf799f5bb0b8504b161661210

Contents?: true

Size: 1.49 KB

Versions: 19

Compression:

Stored size: 1.49 KB

Contents

# frozen_string_literal: true

require "active_support/concern"

module Decidim
  module ParticipatoryProcesses
    module Admin
      module Concerns
        # This concern is meant to be included in all controllers that are scoped
        # into a participatory process' admin panel. It will override the layout
        # so it shows the sidebar, preload the participatory process, etc.
        module ParticipatoryProcessAdmin
          extend ActiveSupport::Concern

          included do
            include Decidim::Admin::ParticipatorySpaceAdminContext
            helper_method :current_participatory_process
            participatory_space_admin_layout

            def organization_processes
              @organization_processes ||= OrganizationParticipatoryProcesses.new(current_organization).query
            end

            def current_participatory_space
              request.env["current_participatory_space"] ||
                organization_processes.find_by!(slug: params[:participatory_process_slug] || params[:slug])
            end

            def permissions_context
              super.merge(current_participatory_space: current_participatory_space)
            end

            alias_method :current_participatory_process, :current_participatory_space

            def permission_class_chain
              [
                Decidim::ParticipatoryProcesses::Permissions,
                Decidim::Admin::Permissions
              ]
            end
          end
        end
      end
    end
  end
end

Version data entries

19 entries across 19 versions & 1 rubygems

Version Path
decidim-participatory_processes-0.17.2 app/controllers/decidim/participatory_processes/admin/concerns/participatory_process_admin.rb
decidim-participatory_processes-0.17.1 app/controllers/decidim/participatory_processes/admin/concerns/participatory_process_admin.rb
decidim-participatory_processes-0.16.1 app/controllers/decidim/participatory_processes/admin/concerns/participatory_process_admin.rb
decidim-participatory_processes-0.17.0 app/controllers/decidim/participatory_processes/admin/concerns/participatory_process_admin.rb
decidim-participatory_processes-0.16.0 app/controllers/decidim/participatory_processes/admin/concerns/participatory_process_admin.rb
decidim-participatory_processes-0.15.2 app/controllers/decidim/participatory_processes/admin/concerns/participatory_process_admin.rb
decidim-participatory_processes-0.15.1 app/controllers/decidim/participatory_processes/admin/concerns/participatory_process_admin.rb
decidim-participatory_processes-0.15.0 app/controllers/decidim/participatory_processes/admin/concerns/participatory_process_admin.rb
decidim-participatory_processes-0.14.4 app/controllers/decidim/participatory_processes/admin/concerns/participatory_process_admin.rb
decidim-participatory_processes-0.14.3 app/controllers/decidim/participatory_processes/admin/concerns/participatory_process_admin.rb
decidim-participatory_processes-0.14.2 app/controllers/decidim/participatory_processes/admin/concerns/participatory_process_admin.rb
decidim-participatory_processes-0.14.1 app/controllers/decidim/participatory_processes/admin/concerns/participatory_process_admin.rb
decidim-participatory_processes-0.13.1 app/controllers/decidim/participatory_processes/admin/concerns/participatory_process_admin.rb
decidim-participatory_processes-0.12.2 app/controllers/decidim/participatory_processes/admin/concerns/participatory_process_admin.rb
decidim-participatory_processes-0.13.0 app/controllers/decidim/participatory_processes/admin/concerns/participatory_process_admin.rb
decidim-participatory_processes-0.12.1 app/controllers/decidim/participatory_processes/admin/concerns/participatory_process_admin.rb
decidim-participatory_processes-0.13.0.pre1 app/controllers/decidim/participatory_processes/admin/concerns/participatory_process_admin.rb
decidim-participatory_processes-0.12.0 app/controllers/decidim/participatory_processes/admin/concerns/participatory_process_admin.rb
decidim-participatory_processes-0.12.0.pre app/controllers/decidim/participatory_processes/admin/concerns/participatory_process_admin.rb