Give Notifications settings its own alert area.

(imported from commit 1d17b85f383862d1f37b5750af40aa8d9a1d8bf2)
This commit is contained in:
Steve Howell 2013-10-25 17:52:45 -04:00
parent 68942a8f3a
commit af6de2053e
2 changed files with 14 additions and 4 deletions

View File

@ -973,7 +973,8 @@ $(function () {
password_quality($('#new_password').val(), $('#pw_strength .bar'));
});
var settings_status = $('#settings-status');
var settings_status = $('#settings-status').expectOne();
var notify_settings_status = $('#notify-settings-status').expectOne();
function settings_change_error(message) {
// Scroll to the top so the error message is visible.
@ -1059,7 +1060,7 @@ $(function () {
page_params.enable_offline_push_notifications = result.enable_offline_push_notifications;
}
settings_status.removeClass(status_classes)
notify_settings_status.removeClass(status_classes)
.addClass('alert-success')
.text(message).stop(true).fadeTo(0,1);
// TODO: In theory we should auto-reload or something if
@ -1073,7 +1074,10 @@ $(function () {
// a nice response.
response += ": " + $.parseJSON(xhr.responseText).msg;
}
settings_change_error(response);
notify_settings_status.removeClass(status_classes)
.addClass('alert-error')
.text(response).stop(true).fadeTo(0,1);
}
});

View File

@ -2,9 +2,10 @@
<h1><i class="icon-vector-wrench settings-icon"></i>Settings</h1>
<div class="alert" id="settings-status"></div>
<div id="settings-change-box">
<div class="alert" id="settings-status"></div>
<form action="/json/settings/change" method="post"
class="form-horizontal your-account-settings">{% csrf_token %}
@ -87,6 +88,11 @@
</form>
<div class="alert" id="notify-settings-status"></div>
<form action="/json/notify_settings/change" method="post"
class="form-horizontal notify-settings">{% csrf_token %}