Fix bulk editing

This commit is contained in:
Zach Gollwitzer
2025-05-06 11:01:15 -04:00
parent 2000f05453
commit 2e0794b8e1

View File

@@ -43,21 +43,26 @@ class DialogComponent < ViewComponent::Base
full: "lg:max-w-full"
}.freeze
def initialize(variant: "modal", auto_open: true, reload_on_close: false, width: "md", disable_frame: false, **opts)
def initialize(variant: "modal", auto_open: true, reload_on_close: false, width: "md", frame: nil, disable_frame: false, **opts)
@variant = variant.to_sym
@auto_open = auto_open
@reload_on_close = reload_on_close
@width = width.to_sym
@frame = frame
@disable_frame = disable_frame
@opts = opts
end
def frame
@frame || variant
end
# Caller must "opt-out" of using the default turbo-frame based on the variant
def wrapper_element(&block)
if disable_frame
content_tag(:div, &block)
else
content_tag("turbo-frame", id: variant, &block)
content_tag("turbo-frame", id: frame, &block)
end
end