Allow edited action to keep its name when editing it (fixes: #1), made dialogs respond to enter and escape, Confirm dialog now shows dark red color for dangerous operations and prevents enter for accepting it

This commit is contained in:
2021-02-10 22:21:53 -06:00
parent 9999026969
commit 3cc4c204a7
12 changed files with 94 additions and 44 deletions

View File

@@ -48,21 +48,25 @@ module TAC
end
button @options[:variable] ? "Update" : "Add", width: 0.475 do |b|
if valid?
value = @type == :boolean ? @value_boolean.value.to_s : @value.value.strip
if @options[:variable]
@options[:callback_method].call(@options[:variable], @name.value.strip, @type, value)
else
@options[:callback_method].call(@name.value.strip, @type, value)
end
close
end
try_commit
end
end
end
def try_commit
if valid?
value = @type == :boolean ? @value_boolean.value.to_s : @value.value.strip
if @options[:variable]
@options[:callback_method].call(@options[:variable], @name.value.strip, @type, value)
else
@options[:callback_method].call(@name.value.strip, @type, value)
end
close
end
end
def valid?
valid = true