Class: DaisyUI::Modal
- Inherits:
-
Base
- Object
- Phlex::HTML
- Base
- DaisyUI::Modal
show all
- Defined in:
- lib/daisy_ui/modal.rb
Constant Summary
Constants inherited
from Base
Base::BOOLS, Base::COLOR_MODIFIERS
Instance Method Summary
collapse
Methods inherited from Base
inherited, register_modifiers
Constructor Details
#initialize(id:) ⇒ Modal
Returns a new instance of Modal.
7
8
9
|
# File 'lib/daisy_ui/modal.rb', line 7
def initialize(*, id:, **)
super
end
|
Instance Method Details
#action(as: :div, **options, &block) ⇒ Object
23
24
25
26
27
28
|
# File 'lib/daisy_ui/modal.rb', line 23
def action(*, as: :div, **options, &block)
action_classes = component_classes("modal-action", options:)
public_send(as, class: action_classes, **options) do
block&.call(self)
end
end
|
#backdrop(**options) ⇒ Object
30
31
32
33
34
35
|
# File 'lib/daisy_ui/modal.rb', line 30
def backdrop(*, **options, &)
backdrop_classes = component_classes("modal-backdrop", options:)
form method: :dialog, class: backdrop_classes, **options do
button
end
end
|
#body(as: :div, **options) ⇒ Object
19
20
21
|
# File 'lib/daisy_ui/modal.rb', line 19
def body(*, as: :div, **options, &)
public_send(as, class: component_classes("modal-box", options:), **options, &)
end
|
37
38
39
40
41
|
# File 'lib/daisy_ui/modal.rb', line 37
def close_button(*, **, &)
form method: :dialog do
render DaisyUI::Button.new(*, **, &)
end
end
|
#view_template(&block) ⇒ Object
11
12
13
14
15
16
17
|
# File 'lib/daisy_ui/modal.rb', line 11
def view_template(&block)
dialog(id:, class: classes, **attributes) do
block&.call(self)
backdrop if modifiers.include?(:tap_outside_to_close)
end
end
|