Renamed the helper and removed code that does not apply to the general settings page any more

This commit is contained in:
alextselegidis 2021-11-18 08:58:19 +01:00
parent 2d1fb357c8
commit d00a8956d7
2 changed files with 7 additions and 48 deletions

View file

@ -44,31 +44,10 @@ window.BackendSettingsGeneral = window.BackendSettingsGeneral || {};
GlobalVariables.settings.system.forEach(function (setting) {
$('input[data-field="' + setting.name + '"]').val(setting.value);
$('select[data-field="' + setting.name + '"]').val(setting.value);
if (setting.name === 'customer_notifications') {
$('#customer-notifications').prop('checked', Boolean(Number(setting.value)));
}
if (setting.name === 'require_captcha') {
$('#require-captcha').prop('checked', Boolean(Number(setting.value)));
}
if (setting.name === 'require_phone_number') {
$('#require-phone-number').prop('checked', Boolean(Number(setting.value)));
}
if (setting.name === 'display_any_provider') {
$('#display-any-provider').prop('checked', Boolean(Number(setting.value)));
}
if (setting.name === 'display_cookie_notice') {
$('#display-cookie-notice').prop('checked', Boolean(Number(setting.value)));
}
});
// Set default settings helper.
settings = new SystemSettingsGeneral();
settings = new SystemSettingsGeneralHelper();
if (defaultEventHandlers) {
bindEventHandlers();

View file

@ -15,9 +15,9 @@
/**
* "System Settings" Tab Helper Class
*
* @class SystemSettingsGeneral
* @class SystemSettingsGeneralHelper
*/
var SystemSettingsGeneral = function () {};
var SystemSettingsGeneralHelper = function () {};
/**
* Save the system settings.
@ -26,7 +26,7 @@
*
* @param {Array} settings Contains the system settings data.
*/
SystemSettingsGeneral.prototype.save = function (settings) {
SystemSettingsGeneralHelper.prototype.save = function (settings) {
if (!this.validate()) {
return; // Validation failed, do not proceed.
}
@ -69,7 +69,7 @@
*
* @return {Array} Returns the system settings array.
*/
SystemSettingsGeneral.prototype.get = function () {
SystemSettingsGeneralHelper.prototype.get = function () {
var settings = [];
// General Settings Tab
@ -84,26 +84,6 @@
});
});
settings.push({
name: 'customer_notifications',
value: $('#customer-notifications').prop('checked') ? '1' : '0'
});
settings.push({
name: 'require_captcha',
value: $('#require-captcha').prop('checked') ? '1' : '0'
});
settings.push({
name: 'require_phone_number',
value: $('#require-phone-number').prop('checked') ? '1' : '0'
});
settings.push({
name: 'display_any_provider',
value: $('#display-any-provider').prop('checked') ? '1' : '0'
});
return settings;
};
@ -114,7 +94,7 @@
*
* @return {Boolean} Returns the validation result.
*/
SystemSettingsGeneral.prototype.validate = function () {
SystemSettingsGeneralHelper.prototype.validate = function () {
$('#general .has-error').removeClass('has-error');
try {
@ -144,5 +124,5 @@
}
};
window.SystemSettingsGeneral = SystemSettingsGeneral;
window.SystemSettingsGeneralHelper = SystemSettingsGeneralHelper;
})();