Sha256: 82707bc2ffe01fcd3bed34a61711a5aada6819be3eacfcd25041385549e24f10

Contents?: true

Size: 1.03 KB

Versions: 6

Compression:

Stored size: 1.03 KB

Contents

# frozen_string_literal: true

module Decidim
  module Admin
    module Features
      # This controller is the abstract class from which all feature
      # controllers in their admin engines should inherit from.
      class BaseController < Admin::ApplicationController
        skip_authorize_resource
        include Concerns::ParticipatoryProcessAdmin
        include Settings

        helper Decidim::ResourceHelper
        helper Decidim::Admin::ExportsHelper

        helper_method :current_feature,
                      :parent_path

        delegate :active_step, to: :current_participatory_process, prefix: false

        before_action except: [:index, :show] do
          authorize! :manage, current_feature
        end

        before_action on: [:index, :show] do
          authorize! :read, current_feature
        end

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

        def parent_path
          decidim_admin.features_path(current_participatory_process)
        end
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 2 rubygems

Version Path
decidim-admin-0.5.1 app/controllers/decidim/admin/features/base_controller.rb
decidim-0.5.1 decidim-admin/app/controllers/decidim/admin/features/base_controller.rb
decidim-admin-0.5.0 app/controllers/decidim/admin/features/base_controller.rb
decidim-0.5.0 decidim-admin/app/controllers/decidim/admin/features/base_controller.rb
decidim-admin-0.4.4 app/controllers/decidim/admin/features/base_controller.rb
decidim-0.4.4 decidim-admin/app/controllers/decidim/admin/features/base_controller.rb