Sha256: bcd4b4dfd8120918c17851d5859ca1baa42413b16c1e9a2344759307cfeddc06

Contents?: true

Size: 1.49 KB

Versions: 23

Compression:

Stored size: 1.49 KB

Contents

# frozen_string_literal: true

module Decidim
  module Features
    # Controller from which all feature engines inherit from. It's in charge of
    # setting the appropiate layout, including necessary helpers, and overall
    # fooling the engine into thinking it's isolated.
    class BaseController < Decidim::ApplicationController
      include Settings
      include ActionAuthorization

      helper Decidim::FiltersHelper
      helper Decidim::OrdersHelper
      helper Decidim::FeatureReferenceHelper
      helper Decidim::TranslationsHelper
      helper Decidim::IconHelper
      helper Decidim::ResourceHelper
      helper Decidim::ScopesHelper
      helper Decidim::ActionAuthorizationHelper
      helper Decidim::AttachmentsHelper

      helper_method :current_feature,
                    :current_participatory_space,
                    :current_manifest

      skip_authorize_resource

      before_action do
        extend current_participatory_space.extension_module

        authorize! :read, current_feature
      end

      def current_feature
        request.env["decidim.current_feature"]
      end

      def current_manifest
        @current_manifest ||= current_feature.manifest
      end

      def current_participatory_space
        current_feature.participatory_space
      end

      def ability_context
        super.merge(
          current_manifest: current_manifest,
          current_settings: current_settings,
          feature_settings: feature_settings
        )
      end
    end
  end
end

Version data entries

23 entries across 23 versions & 2 rubygems

Version Path
decidim-core-0.7.4 app/controllers/decidim/features/base_controller.rb
decidim-core-0.7.3 app/controllers/decidim/features/base_controller.rb
decidim-core-0.7.2 app/controllers/decidim/features/base_controller.rb
decidim-core-0.7.1 app/controllers/decidim/features/base_controller.rb
decidim-core-0.7.0 app/controllers/decidim/features/base_controller.rb
decidim-core-0.6.8 app/controllers/decidim/features/base_controller.rb
decidim-0.6.8 decidim-core/app/controllers/decidim/features/base_controller.rb
decidim-core-0.6.7 app/controllers/decidim/features/base_controller.rb
decidim-0.6.7 decidim-core/app/controllers/decidim/features/base_controller.rb
decidim-core-0.6.6 app/controllers/decidim/features/base_controller.rb
decidim-0.6.6 decidim-core/app/controllers/decidim/features/base_controller.rb
decidim-core-0.6.5 app/controllers/decidim/features/base_controller.rb
decidim-0.6.5 decidim-core/app/controllers/decidim/features/base_controller.rb
decidim-core-0.6.4 app/controllers/decidim/features/base_controller.rb
decidim-0.6.4 decidim-core/app/controllers/decidim/features/base_controller.rb
decidim-core-0.6.3 app/controllers/decidim/features/base_controller.rb
decidim-0.6.3 decidim-core/app/controllers/decidim/features/base_controller.rb
decidim-core-0.6.2 app/controllers/decidim/features/base_controller.rb
decidim-0.6.2 decidim-core/app/controllers/decidim/features/base_controller.rb
decidim-core-0.6.1 app/controllers/decidim/features/base_controller.rb