Sha256: a81078f83ad823874ffdc7ef75fc8ce424ac584cf05b553452ecfd0714433d18

Contents?: true

Size: 1.17 KB

Versions: 10

Compression:

Stored size: 1.17 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

            alias_method :current_participatory_process, :current_participatory_space
          end
        end
      end
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
decidim-participatory_processes-0.11.2 app/controllers/decidim/participatory_processes/admin/concerns/participatory_process_admin.rb
decidim-participatory_processes-0.11.1 app/controllers/decidim/participatory_processes/admin/concerns/participatory_process_admin.rb
decidim-participatory_processes-0.11.0.pre1 app/controllers/decidim/participatory_processes/admin/concerns/participatory_process_admin.rb
decidim-participatory_processes-0.10.1 app/controllers/decidim/participatory_processes/admin/concerns/participatory_process_admin.rb
decidim-participatory_processes-0.10.0 app/controllers/decidim/participatory_processes/admin/concerns/participatory_process_admin.rb
decidim-participatory_processes-0.9.3 app/controllers/decidim/participatory_processes/admin/concerns/participatory_process_admin.rb
decidim-participatory_processes-0.9.2 app/controllers/decidim/participatory_processes/admin/concerns/participatory_process_admin.rb
decidim-participatory_processes-0.9.1 app/controllers/decidim/participatory_processes/admin/concerns/participatory_process_admin.rb
decidim-participatory_processes-0.9.0 app/controllers/decidim/participatory_processes/admin/concerns/participatory_process_admin.rb
decidim-participatory_processes-0.8.4 app/controllers/decidim/participatory_processes/admin/concerns/participatory_process_admin.rb