settings: Add loading indicator for account deactivation.

Fixes #8175.
This commit is contained in:
Aastha Gupta 2018-01-26 12:31:58 +05:30 committed by Tim Abbott
parent 65767e5226
commit 2f99e6b7b2
3 changed files with 33 additions and 10 deletions

View File

@ -259,16 +259,27 @@ exports.set_up = function () {
});
$("#do_deactivate_self_button").on('click',function () {
$("#deactivate_self_modal").modal("hide");
channel.del({
url: '/json/users/me',
success: function () {
window.location.href = "/login";
},
error: function (xhr) {
ui_report.error(i18n.t("Error deactivating account"), xhr, $('#account-settings-status').expectOne());
},
$("#do_deactivate_self_button .loader").css('display', 'inline-block');
$("#do_deactivate_self_button span").hide();
$("#do_deactivate_self_button object").on("load", function () {
var doc = this.getSVGDocument();
var $svg = $(doc).find("svg");
$svg.find("rect").css("fill", "#000");
});
setTimeout(function () {
channel.del({
url: '/json/users/me',
success: function () {
$("#deactivate_self_modal").modal("hide");
window.location.href = "/login";
},
error: function (xhr) {
$("#deactivate_self_modal").modal("hide");
ui_report.error(i18n.t("Error deactivating account"), xhr, $('#account-settings-status').expectOne());
},
});
}, 5000);
});

View File

@ -1150,6 +1150,15 @@ input[type=checkbox].inline-block {
border-radius: 0px;
}
#do_deactivate_self_button .loader {
display: none;
vertical-align: top;
position: relative;
height: 30px;
margin-top: -10px;
top: 5px;
}
#id_realm_notifications_stream .dropdown-search > input[type=text],
#id_realm_signup_notifications_stream .dropdown-search > input[type=text] {
margin: 9px;

View File

@ -158,7 +158,10 @@
</div>
<div class="modal-footer">
<button class="button" data-dismiss="modal">{{t "Cancel" }}</button>
<button class="button btn-danger rounded" id="do_deactivate_self_button">{{t "Deactivate now" }}</button>
<button class="button btn-danger rounded" id="do_deactivate_self_button">
<object class="loader" type="image/svg+xml" data="/static/images/loader.svg"></object>
<span>{{t "Deactivate now" }}</span>
</button>
</div>
</div>