Skip to content

Commit 6737757

Browse files
pushed load json data into conditional which does nothing if the container format isn't adhered to
1 parent 0118512 commit 6737757

File tree

1 file changed

+26
-26
lines changed

1 file changed

+26
-26
lines changed

lib/Toolbar.js

+26-26
Original file line numberDiff line numberDiff line change
@@ -416,29 +416,29 @@ class Toolbar {
416416
alert(
417417
'Error: JSON data file does not have Container dictionary.'
418418
);
419-
}
420-
421-
// NOTE: the data is possibly *sparse*. where does it make sense to fill in its missing alues?
422-
// It doesn't appear to matter
423-
424-
for (const dh in context.dhs) {
425-
const container_class = rangeToContainerClass(
426-
context.template.default.schema.classes.Container,
427-
dh
428-
);
429-
const list_data = context.dhs[dh].loadDataObjects(
430-
jsonData.Container[container_class],
431-
locale
432-
);
433-
if (list_data) context.dhs[dh].hot.loadData(list_data);
434-
else
435-
alert(
436-
'Unable to fetch table data from json file ' +
437-
template_path +
438-
' for ' +
439-
dh
419+
} else {
420+
// NOTE: the data is possibly *sparse*. where does it make sense to fill in its missing alues?
421+
// It doesn't appear to matter
422+
for (const dh in context.dhs) {
423+
const container_class = rangeToContainerClass(
424+
context.template.default.schema.classes.Container,
425+
dh
440426
);
427+
const list_data = context.dhs[dh].loadDataObjects(
428+
jsonData.Container[container_class],
429+
locale
430+
);
431+
if (list_data) context.dhs[dh].hot.loadData(list_data);
432+
else
433+
alert(
434+
'Unable to fetch table data from json file ' +
435+
template_path +
436+
' for ' +
437+
dh
438+
);
439+
}
441440
}
441+
442442
return context;
443443
})
444444
.then(this.restartInterface.bind(this));
@@ -912,10 +912,6 @@ class Toolbar {
912912
}
913913
});
914914

915-
//
916-
// DEPRECATE: no need to refresh the translation select since the languages are taken from a global list
917-
// it's up to the templates to ensure all the languages are supported
918-
//
919915
const currentTranslationVal = $('#select-translation-localization').val();
920916
const translationSelect = $('#select-translation-localization').empty();
921917
for (const { nativeName, langcode } of Object.values(
@@ -925,9 +921,13 @@ class Toolbar {
925921
}
926922
if (currentTranslationVal) {
927923
translationSelect.val(currentTranslationVal);
924+
//
925+
// DEPRECATE: no need to refresh the translation select since the languages are taken from a global list
926+
// it's up to the templates to ensure all the languages are supported
927+
//
928928
// translationSelect.trigger('input');
929929
} else {
930-
// translationSelect.val('en');
930+
translationSelect.val('en');
931931
}
932932

933933
const helpSop = $('#help_sop');

0 commit comments

Comments
 (0)