custom profile data: Enable user to edit custom field's value in settings.

This will enable user to edit the value of custom fields from
user settings.
This commit is contained in:
YJDave 2018-02-27 01:12:37 +05:30 committed by Tim Abbott
parent b404d0e156
commit 82c8d43209
1 changed files with 14 additions and 0 deletions

View File

@ -310,6 +310,20 @@ exports.set_up = function () {
$("#deactivate_self_modal").modal("show");
});
$(".custom_user_field input, .custom_user_field textarea").on('change', function () {
var fields = [];
var value = $(this).val();
var spinner = $("#custom-field-status").expectOne();
loading.make_indicator(spinner, {text: 'Saving ...'});
if ($(this).attr("type") === "number") {
value = parseInt(value, 10);
}
fields.push({id: parseInt($(this).attr("id"), 10), value: value});
settings_ui.do_settings_change(channel.patch, "/json/users/me/profile_data",
{data: JSON.stringify(fields)}, spinner);
});
$("#do_deactivate_self_button").on('click',function () {
$("#do_deactivate_self_button .loader").css('display', 'inline-block');
$("#do_deactivate_self_button span").hide();