Added filter for NamePromptDialog, configurations can now be renamed

This commit is contained in:
2020-06-23 09:50:53 -05:00
parent 17e4290033
commit ffd8146fe3
3 changed files with 22 additions and 2 deletions

View File

@@ -53,10 +53,25 @@ module TAC
name = File.basename(config_file, ".json")
button "#{name}", width: 0.965 do
button "#{name}", width: 0.94 do
change_config(name)
end
button get_image("#{TAC::ROOT_PATH}/media/icons/gear.png"), image_width: THEME_ICON_SIZE, tip: "Rename configuration" do
push_state(Dialog::NamePromptDialog, title: "Rename Config", callback_method: proc { |new_name|
FileUtils.mv(
"#{TAC::CONFIGS_PATH}/#{name}.json",
"#{TAC::CONFIGS_PATH}/#{new_name}.json"
)
if window.backend.settings.config == name
change_config(new_name)
end
populate_configs
})
end
button get_image("#{TAC::ROOT_PATH}/media/icons/trashcan.png"), image_width: THEME_ICON_SIZE, **THEME_DANGER_BUTTON, tip: "Delete configuration" do
push_state(Dialog::ConfirmDialog, title: "Delete Config?", callback_method: proc {
File.delete("#{TAC::CONFIGS_PATH}/#{name}.json")