Show a loading indicator while the subscriber list is loading

(imported from commit 83c6d64f665e82d1cff6e9654342d2a6c4bf6f36)
This commit is contained in:
Zev Benjamin 2013-01-16 16:02:49 -05:00
parent 661632673b
commit 747df69de1
3 changed files with 10 additions and 1 deletions

View File

@ -26,6 +26,7 @@
</div>
</div>
<div class="subscriber_list_container">
<div class="subscriber_list_loading_indicator"></div>
<div class="alert alert-error hide"></div>
<div class="alert alert-warning hide"></div>
<ul>

View File

@ -336,17 +336,20 @@ $(function () {
var stream = sub_row.find('.subscription_name').text();
var error_elem = sub_row.find('.subscriber_list_container .alert-error');
var list = sub_row.find('.subscriber_list_container ul');
var indicator_elem = sub_row.find('.subscriber_list_loading_indicator');
error_elem.addClass('hide');
list.empty();
// TODO: Show a spinner while the list is loading
util.make_loading_indicator(indicator_elem);
$.ajax({
type: "POST",
url: "/json/get_subscribers",
dataType: 'json', // This seems to be ignored. We still get back an xhr.
data: {stream: stream},
success: function (data) {
util.destroy_loading_indicator(indicator_elem);
var subscribers = $.map(data.subscribers, function (elem) {
var person = people_dict[elem];
if (person === undefined) {
@ -359,6 +362,7 @@ $(function () {
});
},
error: function (xhr) {
util.destroy_loading_indicator(indicator_elem);
error_elem.removeClass("hide").text("Could not fetch subscriber list");
}
});

View File

@ -610,6 +610,10 @@ table.floating_recipient {
margin: 10px auto;
}
.subscriber_list_loading_indicator {
margin: 10px auto;
}
.table-striped thead th {
background-color: #444;
color: white;