2017-04-06 17:47:36 +02:00
|
|
|
var settings_lab = (function () {
|
|
|
|
|
|
|
|
var exports = {};
|
|
|
|
|
|
|
|
exports.set_up = function () {
|
|
|
|
$("#ui-settings-status").hide();
|
|
|
|
|
2018-04-17 21:52:25 +02:00
|
|
|
$("#ui-settings .ui-settings-form").change(function (e) {
|
2017-04-06 17:47:36 +02:00
|
|
|
e.preventDefault();
|
|
|
|
var labs_updates = {};
|
2017-12-27 13:17:58 +01:00
|
|
|
_.each(["default_desktop_notifications"],
|
2017-04-06 17:47:36 +02:00
|
|
|
function (setting) {
|
|
|
|
labs_updates[setting] = $("#" + setting).is(":checked");
|
2017-09-09 22:38:13 +02:00
|
|
|
});
|
|
|
|
|
|
|
|
channel.patch({
|
|
|
|
url: '/json/settings/ui',
|
|
|
|
data: labs_updates,
|
2017-12-27 13:17:58 +01:00
|
|
|
success: function () {
|
2017-09-09 22:38:13 +02:00
|
|
|
var message = i18n.t("Updated settings! You will need to reload for these changes to take effect.", page_params);
|
|
|
|
var ui_settings_status = $('#ui-settings-status').expectOne();
|
|
|
|
|
|
|
|
ui_report.success(message, ui_settings_status);
|
|
|
|
},
|
|
|
|
error: function (xhr) {
|
|
|
|
ui_report.error(i18n.t("Error changing settings"), xhr, $('#ui-settings-status').expectOne());
|
|
|
|
},
|
|
|
|
});
|
2017-04-06 17:47:36 +02:00
|
|
|
});
|
|
|
|
};
|
|
|
|
|
|
|
|
return exports;
|
|
|
|
}());
|
|
|
|
|
|
|
|
if (typeof module !== 'undefined') {
|
|
|
|
module.exports = settings_lab;
|
|
|
|
}
|