Sha256: 3846514ceea49080a30b03ceadb7ff6a0e0c974990b3a74d12de8395f649a55e

Contents?: true

Size: 1.04 KB

Versions: 10

Compression:

Stored size: 1.04 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
            alias_method :current_participatory_space, :current_assembly
          end

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

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

Version data entries

10 entries across 10 versions & 1 rubygems

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