Fixed confirm dialog not able to commit

This commit is contained in:
2021-02-13 13:13:22 -06:00
parent 75d6de0b00
commit 5fd494bb47

View File

@@ -2,7 +2,11 @@ module TAC
class Dialog
class ConfirmDialog < Dialog
def build
color = @options[:dangerous] ? Palette::DANGEROUS : Palette::ALERT
@dangerous = @options[:dangerous]
@dangerous ||= false
color = @dangerous ? Palette::DANGEROUS : Palette::ALERT
@dialog_root.style.border_color = [ color, darken(color, 50) ]
@titlebar.style.background = [ color, darken(color, 50) ]
@@ -21,7 +25,11 @@ module TAC
end
def try_commit(force = false)
if not @options[:dangerous] || force
if !@dangerous
close
@options[:callback_method].call
elsif @dangerous && force
close
@options[:callback_method].call