app/components/coco/base/modal/modal.rb in coveragebook_components-0.8.8 vs app/components/coco/base/modal/modal.rb in coveragebook_components-0.8.9
- old
+ new
@@ -9,28 +9,31 @@
renders_one :title
renders_one :container, types: {
dialog: ->(**kwargs, &block) do
@container_content = block
+ @container_type = :dialog
Coco::ModalDialog.new(dismissable: get_option_value(:dismissable), **kwargs)
end,
lightbox: ->(**kwargs, &block) do
+ @container_type = :lightbox
Coco::ModalLightbox.new(dismissable: get_option_value(:dismissable), **kwargs)
end
}
before_render do
if container? && title? && container.respond_to?(:with_title)
container.with_title { title.to_s }
end
end
- attr_reader :name, :show
+ attr_reader :name, :show, :container_type
def initialize(name:, show: false, **kwargs)
@name = name
@show = show
+ @container_type = nil
title { kwargs[:title] } if kwargs[:title]
end
def render_as_modal?
request.headers["Turbo-Frame"].present? || show