Class: ModalStack::Configuration
- Inherits:
-
Object
- Object
- ModalStack::Configuration
- Defined in:
- lib/modal_stack/configuration.rb
Overview
Runtime configuration for the gem. A default instance is created on first access; override via ‘config/initializers/modal_stack.rb`:
ModalStack.configure do |config|
config.css_provider = :bootstrap
config.default_size = :lg
config.replace_turbo_confirm = true
end
Constant Summary collapse
- CSS_PROVIDERS =
%i[tailwind bootstrap vanilla none].freeze
- ASSETS_MODES =
%i[importmap jsbundling sprockets auto].freeze
- VARIANTS =
%i[modal drawer bottom_sheet confirmation].freeze
- SIZES =
%i[sm md lg xl].freeze
- MAX_DEPTH_STRATEGIES =
%i[raise warn silent].freeze
Instance Attribute Summary collapse
-
#assets_mode ⇒ Object
Returns the value of attribute assets_mode.
-
#css_provider ⇒ Object
Returns the value of attribute css_provider.
-
#default_classes ⇒ Object
Returns the value of attribute default_classes.
-
#default_dismissible ⇒ Object
Returns the value of attribute default_dismissible.
-
#default_size ⇒ Object
Returns the value of attribute default_size.
-
#default_variant ⇒ Object
Returns the value of attribute default_variant.
-
#dialog_id ⇒ Object
Returns the value of attribute dialog_id.
-
#i18n_scope ⇒ Object
Returns the value of attribute i18n_scope.
-
#initializer_version ⇒ Object
Returns the value of attribute initializer_version.
-
#max_depth ⇒ Object
Returns the value of attribute max_depth.
-
#max_depth_strategy ⇒ Object
Returns the value of attribute max_depth_strategy.
-
#replace_turbo_confirm ⇒ Object
Returns the value of attribute replace_turbo_confirm.
-
#request_header ⇒ Object
Returns the value of attribute request_header.
-
#respect_reduced_motion ⇒ Object
Returns the value of attribute respect_reduced_motion.
-
#silence_initializer_warning ⇒ Object
Returns the value of attribute silence_initializer_warning.
-
#stack_root_data_attribute ⇒ Object
Returns the value of attribute stack_root_data_attribute.
Instance Method Summary collapse
-
#initialize ⇒ Configuration
constructor
A new instance of Configuration.
Constructor Details
#initialize ⇒ Configuration
Returns a new instance of Configuration.
38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 |
# File 'lib/modal_stack/configuration.rb', line 38 def initialize @css_provider = :tailwind @assets_mode = :auto @default_variant = :modal @default_size = :md @default_dismissible = true @max_depth = 5 @max_depth_strategy = :warn @request_header = "X-Modal-Stack-Request" @dialog_id = "modal-stack-root" @stack_root_data_attribute = "modal-stack" @respect_reduced_motion = true @replace_turbo_confirm = false @i18n_scope = "modal_stack" @initializer_version = nil @silence_initializer_warning = false @default_classes = default_classes_hash end |
Instance Attribute Details
#assets_mode ⇒ Object
Returns the value of attribute assets_mode.
30 31 32 |
# File 'lib/modal_stack/configuration.rb', line 30 def assets_mode @assets_mode end |
#css_provider ⇒ Object
Returns the value of attribute css_provider.
30 31 32 |
# File 'lib/modal_stack/configuration.rb', line 30 def css_provider @css_provider end |
#default_classes ⇒ Object
Returns the value of attribute default_classes.
20 21 22 |
# File 'lib/modal_stack/configuration.rb', line 20 def default_classes @default_classes end |
#default_dismissible ⇒ Object
Returns the value of attribute default_dismissible.
30 31 32 |
# File 'lib/modal_stack/configuration.rb', line 30 def default_dismissible @default_dismissible end |
#default_size ⇒ Object
Returns the value of attribute default_size.
30 31 32 |
# File 'lib/modal_stack/configuration.rb', line 30 def default_size @default_size end |
#default_variant ⇒ Object
Returns the value of attribute default_variant.
30 31 32 |
# File 'lib/modal_stack/configuration.rb', line 30 def default_variant @default_variant end |
#dialog_id ⇒ Object
Returns the value of attribute dialog_id.
20 21 22 |
# File 'lib/modal_stack/configuration.rb', line 20 def dialog_id @dialog_id end |
#i18n_scope ⇒ Object
Returns the value of attribute i18n_scope.
20 21 22 |
# File 'lib/modal_stack/configuration.rb', line 20 def i18n_scope @i18n_scope end |
#initializer_version ⇒ Object
Returns the value of attribute initializer_version.
20 21 22 |
# File 'lib/modal_stack/configuration.rb', line 20 def initializer_version @initializer_version end |
#max_depth ⇒ Object
Returns the value of attribute max_depth.
30 31 32 |
# File 'lib/modal_stack/configuration.rb', line 30 def max_depth @max_depth end |
#max_depth_strategy ⇒ Object
Returns the value of attribute max_depth_strategy.
30 31 32 |
# File 'lib/modal_stack/configuration.rb', line 30 def max_depth_strategy @max_depth_strategy end |
#replace_turbo_confirm ⇒ Object
Returns the value of attribute replace_turbo_confirm.
20 21 22 |
# File 'lib/modal_stack/configuration.rb', line 20 def replace_turbo_confirm @replace_turbo_confirm end |
#request_header ⇒ Object
Returns the value of attribute request_header.
20 21 22 |
# File 'lib/modal_stack/configuration.rb', line 20 def request_header @request_header end |
#respect_reduced_motion ⇒ Object
Returns the value of attribute respect_reduced_motion.
20 21 22 |
# File 'lib/modal_stack/configuration.rb', line 20 def respect_reduced_motion @respect_reduced_motion end |
#silence_initializer_warning ⇒ Object
Returns the value of attribute silence_initializer_warning.
20 21 22 |
# File 'lib/modal_stack/configuration.rb', line 20 def silence_initializer_warning @silence_initializer_warning end |
#stack_root_data_attribute ⇒ Object
Returns the value of attribute stack_root_data_attribute.
20 21 22 |
# File 'lib/modal_stack/configuration.rb', line 20 def stack_root_data_attribute @stack_root_data_attribute end |