Save/restore pack_code and cycle_prefix in the deck task settings

This commit is contained in:
Adam Goldsmith 2021-09-17 15:54:17 -04:00
parent d471e39b45
commit 25262e64cf

View File

@ -261,9 +261,9 @@ function copyCount(copies_list, name) {
} }
} }
function settingsDialog() { function settingsDialog(task_settings) {
const pack_code_field = textField("", 15); const pack_code_field = textField(task_settings.get("arkhamdb_pack_code"), 15);
const cycle_prefix_field = textField("", 3); const cycle_prefix_field = textField(task_settings.get("arkhamdb_cycle_prefix"), 15);
const panel = new Grid(); const panel = new Grid();
panel.place( panel.place(
"Pack Code", "", "Pack Code", "",
@ -296,12 +296,16 @@ function run() {
}, },
perform: function perform(project, task, member) { perform: function perform(project, task, member) {
member = ProjectUtilities.simplify(project, task, member); member = ProjectUtilities.simplify(project, task, member);
const [close_button, pack_code, cycle_prefix] = settingsDialog(); const task_settings = member.getSettings();
const [close_button, pack_code, cycle_prefix] = settingsDialog(task_settings);
// User canceled the dialog or closed it without pressing ok // User canceled the dialog or closed it without pressing ok
if (close_button != 1) { if (close_button != 1) {
return; return;
} }
task_settings.set("arkhamdb_pack_code", pack_code);
task_settings.set("arkhamdb_cycle_prefix", cycle_prefix);
member.writeTaskSettings();
Eons.setWaitCursor(true); Eons.setWaitCursor(true);
try { try {