Class: PhlexKit::AlertDialog
- Inherits:
-
BaseComponent
- Object
- Phlex::HTML
- BaseComponent
- PhlexKit::AlertDialog
- Defined in:
- app/components/phlex_kit/alert_dialog/alert_dialog.rb
Overview
Modal confirm dialog, ported from ruby_ui's RubyUI::AlertDialog. Keeps the Stimulus controller: the trigger clones the (template) content into
as a modal; Cancel removes it. No floating-ui. Compose Trigger + Content (Header/Title/Description + Footer with Cancel + the destructive submit). Tailwind → vanilla.pk-alert-dialog* (alert_dialog.css).
Instance Method Summary collapse
-
#initialize(open: false, **attrs) ⇒ AlertDialog
constructor
A new instance of AlertDialog.
- #view_template(&block) ⇒ Object
Methods inherited from BaseComponent
Constructor Details
#initialize(open: false, **attrs) ⇒ AlertDialog
Returns a new instance of AlertDialog.
8 9 10 11 |
# File 'app/components/phlex_kit/alert_dialog/alert_dialog.rb', line 8 def initialize(open: false, **attrs) @open = open @attrs = attrs end |
Instance Method Details
#view_template(&block) ⇒ Object
13 14 15 16 17 18 |
# File 'app/components/phlex_kit/alert_dialog/alert_dialog.rb', line 13 def view_template(&block) div(**mix({ class: "pk-alert-dialog", data: { controller: "phlex-kit--alert-dialog", phlex_kit__alert_dialog_open_value: @open.to_s } }, @attrs), &block) end |