Sha256: 71ba5a99688174756abe135fb6dd002217f9e6eacb3dafb49b3e305e48151857

Contents?: true

Size: 1.55 KB

Versions: 53

Compression:

Stored size: 1.55 KB

Contents

# frozen_string_literal: true

require "active_support/concern"

module Decidim
  module Assemblies
    module Admin
      module Concerns
        # This concern is meant to be included in all controllers that are scoped
        # into an assembly's admin panel. It will override the layout so it shows
        # the sidebar, preload the assembly, etc.
        module AssemblyAdmin
          extend ActiveSupport::Concern

          RegistersPermissions
            .register_permissions(::Decidim::Assemblies::Admin::Concerns::AssemblyAdmin,
                                  Decidim::Assemblies::Permissions,
                                  Decidim::Admin::Permissions)

          included do
            include Decidim::Admin::ParticipatorySpaceAdminContext
            participatory_space_admin_layout

            helper_method :current_assembly

            def current_assembly
              @current_assembly ||= organization_assemblies.find_by!(
                slug: params[:assembly_slug] || params[:slug]
              )
            end

            alias_method :current_participatory_space, :current_assembly

            def organization_assemblies
              @organization_assemblies ||= OrganizationAssemblies.new(current_organization).query
            end

            def permissions_context
              super.merge(current_participatory_space: current_participatory_space)
            end

            def permission_class_chain
              PermissionsRegistry.chain_for(AssemblyAdmin)
            end
          end
        end
      end
    end
  end
end

Version data entries

53 entries across 53 versions & 1 rubygems

Version Path
decidim-assemblies-0.23.3 app/controllers/decidim/assemblies/admin/concerns/assembly_admin.rb
decidim-assemblies-0.23.2 app/controllers/decidim/assemblies/admin/concerns/assembly_admin.rb
decidim-assemblies-0.23.1 app/controllers/decidim/assemblies/admin/concerns/assembly_admin.rb
decidim-assemblies-0.23.1.rc1 app/controllers/decidim/assemblies/admin/concerns/assembly_admin.rb
decidim-assemblies-0.23.0 app/controllers/decidim/assemblies/admin/concerns/assembly_admin.rb
decidim-assemblies-0.22.0 app/controllers/decidim/assemblies/admin/concerns/assembly_admin.rb
decidim-assemblies-0.21.0 app/controllers/decidim/assemblies/admin/concerns/assembly_admin.rb
decidim-assemblies-0.20.1 app/controllers/decidim/assemblies/admin/concerns/assembly_admin.rb
decidim-assemblies-0.20.0 app/controllers/decidim/assemblies/admin/concerns/assembly_admin.rb
decidim-assemblies-0.19.1 app/controllers/decidim/assemblies/admin/concerns/assembly_admin.rb
decidim-assemblies-0.18.1 app/controllers/decidim/assemblies/admin/concerns/assembly_admin.rb
decidim-assemblies-0.19.0 app/controllers/decidim/assemblies/admin/concerns/assembly_admin.rb
decidim-assemblies-0.18.0 app/controllers/decidim/assemblies/admin/concerns/assembly_admin.rb