mirror of https://github.com/zulip/zulip.git
Show success messages on the subscriptions page.
(imported from commit 771fa4459e6a09ffc4132ccff12372b204334de2)
This commit is contained in:
parent
bcd958f051
commit
2f910a1629
|
@ -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
|
||||||
|
|
|
@ -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) {
|
||||||
|
|
|
@ -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;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue