Class: UI::Modal
Constant Summary
Constants inherited from Base
Instance Method Summary collapse
- #footer(class: nil, &block) ⇒ Object
-
#initialize(**props) ⇒ Modal
constructor
A new instance of Modal.
- #trigger(class: nil, &block) ⇒ Object
- #view_template(&block) ⇒ Object
Methods inherited from Base
Constructor Details
#initialize(**props) ⇒ Modal
Returns a new instance of Modal.
9 10 11 12 13 |
# File 'app/views/ui/modal.rb', line 9 def initialize(**props) super @trigger_block = nil @footer_block = nil end |
Instance Method Details
#footer(class: nil, &block) ⇒ Object
43 44 45 46 47 |
# File 'app/views/ui/modal.rb', line 43 def (class: nil, &block) @footer_block = block @footer_classes = grab(class:) nil end |
#trigger(class: nil, &block) ⇒ Object
37 38 39 40 41 |
# File 'app/views/ui/modal.rb', line 37 def trigger(class: nil, &block) @trigger_block = block @trigger_classes = grab(class:) nil end |
#view_template(&block) ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'app/views/ui/modal.rb', line 15 def view_template(&block) vanish(&block) if block_given? div data: {controller: "modal", modal_open_value: open}.merge(backdrop_closeable_attributes) do dialog(data: {modal_target: "dialog"}, class: classes) do div(class: "ui-modal-body") do div(class: "flex justify-between items-start") do render_heading render_close_trigger end render_text yield end end render_trigger end end |