Sha256: e533abf52cbccc890b7cc3c006764fd0a39d1425bcb7f53a6fbaa91183e8f308

Contents?: true

Size: 1.23 KB

Versions: 8

Compression:

Stored size: 1.23 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 NeedsParticipatoryProcess
        include FeatureSettings

        helper Decidim::Admin::ExportsHelper

        helper_method :current_feature,
                      :current_participatory_process,
                      :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 current_participatory_process
          request.env["decidim.current_participatory_process"]
        end

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

Version data entries

8 entries across 8 versions & 2 rubygems

Version Path
decidim-admin-0.3.2 app/controllers/decidim/admin/features/base_controller.rb
decidim-0.3.2 decidim-admin/app/controllers/decidim/admin/features/base_controller.rb
decidim-admin-0.3.1 app/controllers/decidim/admin/features/base_controller.rb
decidim-0.3.1 decidim-admin/app/controllers/decidim/admin/features/base_controller.rb
decidim-admin-0.3.0 app/controllers/decidim/admin/features/base_controller.rb
decidim-0.3.0 decidim-admin/app/controllers/decidim/admin/features/base_controller.rb
decidim-admin-0.2.0 app/controllers/decidim/admin/features/base_controller.rb
decidim-0.2.0 decidim-admin/app/controllers/decidim/admin/features/base_controller.rb