Show success messages on the subscriptions page.

(imported from commit 771fa4459e6a09ffc4132ccff12372b204334de2)
This commit is contained in:
Tim Abbott 2012-10-09 14:56:11 -04:00
parent bcd958f051
commit 2f910a1629
3 changed files with 11 additions and 1 deletions

View File

@ -32,7 +32,7 @@ var globals =
// ui.js // ui.js
+ ' register_onclick hide_email show_email' + ' register_onclick hide_email show_email'
+ ' report_error clicking mouse_moved' + ' report_error report_success clicking mouse_moved'
+ ' update_autocomplete autocomplete_needs_update' + ' update_autocomplete autocomplete_needs_update'
// zephyr.js // zephyr.js

View File

@ -48,6 +48,8 @@ $(function () {
class_list.splice(removal_index, 1); class_list.splice(removal_index, 1);
} }
update_autocomplete(); update_autocomplete();
report_success("Successfully removed subscription to " + name,
$("#subscriptions-status"));
}, },
error: function (xhr) { error: function (xhr) {
report_error("Error removing subscription", xhr, $("#subscriptions-status")); report_error("Error removing subscription", xhr, $("#subscriptions-status"));
@ -61,6 +63,8 @@ $(function () {
var name = $.parseJSON(xhr.responseText).data; var name = $.parseJSON(xhr.responseText).data;
$('#subscriptions_table').prepend(templates.subscription({subscription: name})); $('#subscriptions_table').prepend(templates.subscription({subscription: name}));
class_list.push(name.toLowerCase()); class_list.push(name.toLowerCase());
report_success("Successfully added subscription to " + name,
$("#subscriptions-status"));
$("#new_subscription").focus(); $("#new_subscription").focus();
}, },
error: function (xhr) { error: function (xhr) {

View File

@ -51,6 +51,12 @@ function report_error(response, xhr, status_box) {
status_box.show(); status_box.show();
} }
function report_success(response, status_box) {
status_box.removeClass(status_classes).addClass('alert-success')
.text(response).stop(true).fadeTo(0, 1);
status_box.show();
}
var clicking = false; var clicking = false;
var mouse_moved = false; var mouse_moved = false;