Sha256: 1bd7bad7b94c30f02e3a8cbf9a0a18e6ada7f7ad3857165b31401b0d07485f15

Contents?: true

Size: 1.34 KB

Versions: 2

Compression:

Stored size: 1.34 KB

Contents

require 'active_support/core_ext/module/delegation'
require 'active_support/core_ext/module/attribute_accessors'

module Itsf
  module Backend
    module Configuration
      def configure
        yield self
      end

      mattr_accessor(:backend_engines) { [] }
      mattr_accessor(:resource_base_controller) { '::ApplicationController' }
      mattr_accessor(:service_base_controller) { '::ApplicationController' }
      mattr_accessor(:dashboard_base_controller) { '::ApplicationController' }
      mattr_accessor(:home_base_controller) { '::ApplicationController' }
      mattr_accessor :engine_mount_point
      mattr_accessor :title_link
      mattr_accessor :resource_title_methods
      mattr_accessor(:disabled_features) { [] }
      mattr_accessor(:hidden_attributes_for) do
        { index: [], show: [], edit: [] }
      end
      mattr_accessor(:default_pagination_size) { 15 }
      mattr_accessor(:main_navigation_style) { :horizontal }

      def registered_controllers
        backend_engines.call.collect do |engine|
          "#{engine.parent}::Configuration".constantize.registered_controllers.call
        end.flatten
      end

      def registered_resources
        registered_controllers.call.collect do |controller|
          controller.resource_class if controller.respond_to?(:resource_class)
        end.compact
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
itsf_backend-1.2.1 lib/itsf/backend/configuration.rb
itsf_backend-1.2.0 lib/itsf/backend/configuration.rb