app/helpers/components/alert_dialog_helper.rb in shadcn-ui-0.0.4 vs app/helpers/components/alert_dialog_helper.rb in shadcn-ui-0.0.5
- old
+ new
@@ -1,6 +1,22 @@
module Components::AlertDialogHelper
- def render_alert_dialog(trigger:, label:, description:, continue:, **options)
- cancel = options[:cancel] || render_button("Cancel", class: "mt-2 sm:mt-0", data: {action: "ui--dialog#close"})
- render "components/ui/alert_dialog", trigger:, label:, description:, continue:, cancel:, **options
+ def render_alert_dialog(**options, &block)
+ content = capture(&block) if block
+ render "components/ui/alert_dialog", content: content, **options
+ end
+
+ def alert_dialog_trigger(&block)
+ content_for :alert_dialog_trigger, capture(&block), flush: true
+ end
+
+ def alert_dialog_content(&block)
+ content_for :alert_dialog_content, capture(&block), flush: true
+ end
+
+ def alert_dialog_continue(&block)
+ content_for :alert_dialog_continue, capture(&block), flush: true
+ end
+
+ def alert_dialog_cancel(&block)
+ content_for :alert_dialog_cancel, capture(&block), flush: true
end
end