Sha256: 11862aeed2281ac9f04ab9262c95907e323675921b80b58f776a731bd9d72c2a

Contents?: true

Size: 1.07 KB

Versions: 11

Compression:

Stored size: 1.07 KB

Contents

# frozen_string_literal: true

module Decidim
  module Initiatives
    # The main admin application controller for initiatives
    class ApplicationController < Decidim::ApplicationController
      include NeedsPermission

      register_permissions(::Decidim::Initiatives::ApplicationController,
                           ::Decidim::Initiatives::Permissions,
                           ::Decidim::Admin::Permissions,
                           ::Decidim::Permissions)

      before_action do
        if Decidim::InitiativesType.joins(:scopes).where(organization: current_organization).all.empty?
          flash[:alert] = t("index.uninitialized", scope: "decidim.initiatives")
          redirect_to(decidim.root_path)
        end
      end

      def permissions_context
        super.merge(
          current_participatory_space: try(:current_participatory_space)
        )
      end

      def permission_class_chain
        ::Decidim.permissions_registry.chain_for(::Decidim::Initiatives::ApplicationController)
      end

      def permission_scope
        :public
      end
    end
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
decidim-initiatives-0.27.9 app/controllers/decidim/initiatives/application_controller.rb
decidim-initiatives-0.27.8 app/controllers/decidim/initiatives/application_controller.rb
decidim-initiatives-0.27.7 app/controllers/decidim/initiatives/application_controller.rb
decidim-initiatives-0.27.6 app/controllers/decidim/initiatives/application_controller.rb
decidim-initiatives-0.26.10 app/controllers/decidim/initiatives/application_controller.rb
decidim-initiatives-0.26.9 app/controllers/decidim/initiatives/application_controller.rb
decidim-initiatives-0.27.5 app/controllers/decidim/initiatives/application_controller.rb
decidim-initiatives-0.26.8 app/controllers/decidim/initiatives/application_controller.rb
decidim-initiatives-0.27.4 app/controllers/decidim/initiatives/application_controller.rb
decidim-initiatives-0.27.3 app/controllers/decidim/initiatives/application_controller.rb
decidim-initiatives-0.26.7 app/controllers/decidim/initiatives/application_controller.rb