fixed #2657 -- there's a slight chance this might break other ACP pages, but my limited testing tells me it is ok so far

v1.18.x
Julian Lam 10 years ago
parent 891731ca52
commit d096a639d6

@ -457,6 +457,17 @@ define('settings', function () {
console.log('[settings] Unable to load settings for hash: ', hash); console.log('[settings] Unable to load settings for hash: ', hash);
return callback(err); return callback(err);
} }
// Parse all values. If they are json, return json
for(var key in values) {
if (values.hasOwnProperty(key)) {
try {
values[key] = JSON.parse(values[key]);
} catch (e) {
// Leave the value as is
}
}
}
$(formEl).deserialize(values); $(formEl).deserialize(values);
@ -474,6 +485,13 @@ define('settings', function () {
values[inputEl.attr('id')] = 'off'; values[inputEl.attr('id')] = 'off';
} }
}); });
// Normalizing value of multiple selects
formEl.find('select[multiple]').each(function(idx, selectEl) {
selectEl = $(selectEl);
values[selectEl.attr('id')] = JSON.stringify(selectEl.val());
});
socket.emit('admin.settings.set', { socket.emit('admin.settings.set', {
hash: hash, hash: hash,
values: values values: values

Loading…
Cancel
Save