mirror of
https://github.com/TimeCrafters/timecrafters_configuration_tool_desktop.git
synced 2025-12-15 21:32:35 +00:00
VariableDialog now reports an error if attempting to name a variable to one that already exists
This commit is contained in:
@@ -79,11 +79,22 @@ module TAC
|
||||
|
||||
def valid?
|
||||
valid = true
|
||||
name = @name.value.strip
|
||||
|
||||
if @name.value.strip.empty?
|
||||
if name.empty?
|
||||
@name_error.value = "Error: Name cannot be blank or only whitespace."
|
||||
@name_error.show
|
||||
valid = false
|
||||
|
||||
### Don't error if renaming variable to itself
|
||||
elsif @options[:variable] && @options[:variable].name == name
|
||||
@name_error.value = ""
|
||||
@name_error.hide
|
||||
|
||||
elsif @options[:list].find { |variable| variable.name == name }
|
||||
@name_error.value = "Error: Name is not unique!"
|
||||
@name_error.show
|
||||
valid = false
|
||||
end
|
||||
|
||||
if not @type
|
||||
|
||||
Reference in New Issue
Block a user