@@ -40,22 +40,32 @@ def with_confirmation_check_box
4040 # @param confirm_button_text [String]
4141 # @param cancel_button_text [String]
4242 # @param check_box_text [String]
43+ # @param live_message_checked [String]
44+ # @param live_message_unchecked [String]
4345 def playground (
4446 icon : :"alert" ,
4547 icon_color : :danger ,
4648 show_description : true ,
4749 show_additional_details : false ,
4850 confirm_button_text : "Understood" ,
4951 cancel_button_text : "NO!" ,
50- check_box_text : "I understand that this deletion cannot be reversed"
52+ check_box_text : "I understand that this deletion cannot be reversed" ,
53+ live_message_checked : "Checkbox checked — you can proceed." ,
54+ live_message_unchecked : "Please check the confirmation box to continue."
5155 )
52- render_with_template ( locals : { icon : icon ,
53- icon_color : icon_color ,
54- show_description : show_description ,
55- show_additional_details : show_additional_details ,
56- confirm_button_text : confirm_button_text ,
57- cancel_button_text : cancel_button_text ,
58- check_box_text : check_box_text } )
56+ render_with_template (
57+ locals : {
58+ icon : icon ,
59+ icon_color : icon_color ,
60+ show_description : show_description ,
61+ show_additional_details : show_additional_details ,
62+ confirm_button_text : confirm_button_text ,
63+ cancel_button_text : cancel_button_text ,
64+ check_box_text : check_box_text ,
65+ live_message_checked : live_message_checked ,
66+ live_message_unchecked : live_message_unchecked
67+ }
68+ )
5969 end
6070
6171 # @label With form using FormBuilder
@@ -96,6 +106,24 @@ def with_form_builder_form_test(route_format: :html)
96106 def with_form_test ( route_format : :html )
97107 render_with_template ( locals : { route_format : route_format } )
98108 end
109+
110+ # @label With confirmation checkbox and custom live messages
111+ # @snapshot interactive
112+ def with_confirmation_check_box_and_live_messages
113+ render ( Primer ::OpenProject ::DangerDialog . new (
114+ title : "Delete dialog" ,
115+ confirmation_live_message_checked : "You checked the box — deletion is now possible." ,
116+ confirmation_live_message_unchecked : "You must check the box to enable deletion."
117+ ) ) do |dialog |
118+ dialog . with_show_button { "Click me" }
119+ dialog . with_confirmation_message do |message |
120+ message . with_heading ( tag : :h2 ) { "Permanently delete this item?" }
121+ message . with_description_content ( "This action is irreversible. Proceed with caution." )
122+ end
123+ dialog . with_confirmation_check_box_content ( "I understand that this deletion cannot be reversed" )
124+ end
125+ end
126+
99127 end
100128 end
101129end
0 commit comments