org settings: Display error message on top of active user setting page.

Currently, an error message on active user setting is showing at
the row of edited user profile in user-profiles-list-table.
Instead, show error message on top of setting page.

Tweaked by tabbott to also remove the HTML element.
This commit is contained in:
YJDave
2018-02-04 11:24:31 +05:30
committed by Tim Abbott
parent dc2b505acb
commit 4119eb342d
2 changed files with 6 additions and 11 deletions

View File

@@ -251,13 +251,10 @@ exports.on_load_success = function (realm_people_data) {
channel.del({
url: '/json/users/' + encodeURIComponent(email),
error: function (xhr) {
if (xhr.status.toString().charAt(0) === "4") {
meta.current_deactivate_user_modal_row.find("button").closest("td").html(
$("<p>").addClass("text-error").text(JSON.parse(xhr.responseText).msg)
);
} else {
meta.current_deactivate_user_modal_row.find("button").text(i18n.t("Failed!"));
}
var status = $("#organization-status").expectOne();
ui_report.error(i18n.t("Failed"), xhr, status);
var button = meta.current_deactivate_user_modal_row.find("button.deactivate");
button.text(i18n.t("Deactivate"));
},
success: function () {
var button = meta.current_deactivate_user_modal_row.find("button.deactivate");
@@ -347,7 +344,7 @@ exports.on_load_success = function (realm_people_data) {
button.text(i18n.t("Remove admin"));
},
error: function (xhr) {
var status = row.find(".admin-user-status");
var status = $("#organization-status").expectOne();
ui_report.error(i18n.t("Failed"), xhr, status);
},
});
@@ -378,7 +375,7 @@ exports.on_load_success = function (realm_people_data) {
button.text(i18n.t("Make admin"));
},
error: function (xhr) {
var status = row.find(".admin-user-status");
var status = $("#organization-status").expectOne();
ui_report.error(i18n.t("Failed"), xhr, status);
},
});

View File

@@ -46,8 +46,6 @@
<button class="button rounded small btn-warning open-user-form{{#unless is_active}} display-none{{/unless}}" title="{{t 'Edit user' }}" data-user-id="{{user_id}}">
<i class="icon-vector-pencil"></i>
</button>
<div class='admin-user-status'>
</div>
</td>
{{/if}}
</tr>