Skip to content

Commit

Permalink
pushed load json data into conditional which does nothing if the cont…
Browse files Browse the repository at this point in the history
…ainer format isn't adhered to
  • Loading branch information
kennethbruskiewicz committed Dec 10, 2024
1 parent 0118512 commit 6737757
Showing 1 changed file with 26 additions and 26 deletions.
52 changes: 26 additions & 26 deletions lib/Toolbar.js
Original file line number Diff line number Diff line change
Expand Up @@ -416,29 +416,29 @@ class Toolbar {
alert(
'Error: JSON data file does not have Container dictionary.'
);
}

// NOTE: the data is possibly *sparse*. where does it make sense to fill in its missing alues?
// It doesn't appear to matter

for (const dh in context.dhs) {
const container_class = rangeToContainerClass(
context.template.default.schema.classes.Container,
dh
);
const list_data = context.dhs[dh].loadDataObjects(
jsonData.Container[container_class],
locale
);
if (list_data) context.dhs[dh].hot.loadData(list_data);
else
alert(
'Unable to fetch table data from json file ' +
template_path +
' for ' +
dh
} else {
// NOTE: the data is possibly *sparse*. where does it make sense to fill in its missing alues?
// It doesn't appear to matter
for (const dh in context.dhs) {
const container_class = rangeToContainerClass(
context.template.default.schema.classes.Container,
dh
);
const list_data = context.dhs[dh].loadDataObjects(
jsonData.Container[container_class],
locale
);
if (list_data) context.dhs[dh].hot.loadData(list_data);
else
alert(
'Unable to fetch table data from json file ' +
template_path +
' for ' +
dh
);
}
}

return context;
})
.then(this.restartInterface.bind(this));
Expand Down Expand Up @@ -912,10 +912,6 @@ class Toolbar {
}
});

//
// DEPRECATE: no need to refresh the translation select since the languages are taken from a global list
// it's up to the templates to ensure all the languages are supported
//
const currentTranslationVal = $('#select-translation-localization').val();
const translationSelect = $('#select-translation-localization').empty();
for (const { nativeName, langcode } of Object.values(
Expand All @@ -925,9 +921,13 @@ class Toolbar {
}
if (currentTranslationVal) {
translationSelect.val(currentTranslationVal);
//
// DEPRECATE: no need to refresh the translation select since the languages are taken from a global list
// it's up to the templates to ensure all the languages are supported
//
// translationSelect.trigger('input');
} else {
// translationSelect.val('en');
translationSelect.val('en');
}

const helpSop = $('#help_sop');
Expand Down

0 comments on commit 6737757

Please sign in to comment.