Skip to content

Commit b729dd1

Browse files
committed
fix(settings): use jQuery DataTable syntax and translate boolean labels
- Change DataTable initialization to jQuery plugin syntax for compatibility with DataTables 1.12.1 (CDN version) - Add boolTrue/boolFalse translations to i18n map - Update modal dialog to use translated labels instead of hard-coded English 'True'/'False' text
1 parent fe22ba7 commit b729dd1

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

website/app-templates/smarty/js/dialogs/dialog_user_settings.tpl.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ $("#modal").on("show.bs.modal", function(event) {
1818
if (settingType === "bool" || settingType === "boolean") {
1919
const trueSelected = (settingCurrent === "true" || settingCurrent === true) ? " selected" : "";
2020
const falseSelected = (settingCurrent === "false" || settingCurrent === false) ? " selected" : "";
21-
inputField = "<select id=\"userSettingValue\" class=\"form-control\"><option value=\"true\"" + trueSelected + ">✓ True</option><option value=\"false\"" + falseSelected + ">✗ False</option></select>";
21+
inputField = "<select id=\"userSettingValue\" class=\"form-control\"><option value=\"true\"" + trueSelected + ">✓ " + i18nUserCustomSettings.boolTrue + "</option><option value=\"false\"" + falseSelected + ">✗ " + i18nUserCustomSettings.boolFalse + "</option></select>";
2222
} else if (settingType && settingType.indexOf("enum:") === 0) {
2323
const enumValues = settingType.substring(5).split("|");
2424
let options = "";

website/app-templates/smarty/js/users/user_settings.tpl.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,9 @@ const i18nUserCustomSettings = {
1111
confirmReset: "{t}Are you sure you want to reset this setting to its default value?{/t}",
1212
editSetting: "{t}Edit Setting{/t}",
1313
currentValue: "{t}Current Value{/t}",
14-
closeButton: "{t}Close{/t}"
14+
closeButton: "{t}Close{/t}",
15+
boolTrue: "{t}True{/t}",
16+
boolFalse: "{t}False{/t}"
1517
};
1618

1719
//{literal}
@@ -99,8 +101,8 @@ function resetUserSetting(name) {
99101
});
100102
}
101103

102-
// Initialize DataTable
103-
const userCustomSettingsTable = new DataTable("#userCustomSettingsTable", {
104+
// Initialize DataTable (using jQuery plugin syntax for DataTables 1.12.1)
105+
const userCustomSettingsTable = $("#userCustomSettingsTable").DataTable({
104106
data: userCustomSettingsData,
105107
columns: [
106108
{

0 commit comments

Comments
 (0)