Sha256: b7b37c164a5bc657f9f84d139377dcec8ddcae7cabc1e8674e58d10da26b1a66

Contents?: true

Size: 1.37 KB

Versions: 19

Compression:

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

          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
              [
                Decidim::Assemblies::Permissions,
                Decidim::Admin::Permissions
              ]
            end
          end
        end
      end
    end
  end
end

Version data entries

19 entries across 19 versions & 1 rubygems

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