Sha256: 49c8b6663ce80339f46d6972810b507af8c330792ecf72fbbf18ce9d1daa8e9a

Contents?: true

Size: 1.27 KB

Versions: 1

Compression:

Stored size: 1.27 KB

Contents

# encoding: utf-8
require 'rails-settings-ui/engine'
require 'rails-settings-ui/main_app_route_delegator'
require 'rails-settings-ui/version'

require "rails-settings-ui/settings_form_validator"
require "rails-settings-ui/settings_form_coercible"

module RailsSettingsUi
  mattr_accessor :parent_controller
  self.parent_controller = '::ApplicationController'

  # Settings not displayed in the interface (eg. [:launch_mode, :project_name])
  mattr_accessor :ignored_settings
  self.ignored_settings = []

  # Settings displayed in the interface as select tag instead checkboxes (useful for array with one possible choice)
  mattr_accessor :settings_displayed_as_select_tag
  self.settings_displayed_as_select_tag = []

  mattr_accessor :settings_class
  self.settings_class = "Settings"

  class << self
    def inline_main_app_routes!
      ::RailsSettingsUi::ApplicationController.helper ::RailsSettingsUi::MainAppRouteDelegator
    end

    def setup
      yield self
    end

    def settings_klass
      settings_class.constantize
    end

    def default_settings
      if Gem.loaded_specs['rails-settings-cached'].version.to_s >= '0.6.0'
        RailsSettings::Default.instance.with_indifferent_access
      else
        RailsSettingsUi.settings_klass.defaults
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
rails-settings-ui-1.2.0 lib/rails-settings-ui.rb