Added loading spinner to users list on scroll

This commit is contained in:
Vincent Petry 2014-02-18 10:52:05 +01:00
parent c732764eb5
commit 58b1dc5e76
1 changed files with 4 additions and 0 deletions

View File

@ -223,6 +223,7 @@ var UserList = {
if (UserList.updating) { if (UserList.updating) {
return; return;
} }
$('table+.loading').css('visibility', 'visible');
UserList.updating = true; UserList.updating = true;
$.get(OC.Router.generate('settings_ajax_userlist', { offset: UserList.offset, limit: UserList.usersToLoad }), function (result) { $.get(OC.Router.generate('settings_ajax_userlist', { offset: UserList.offset, limit: UserList.usersToLoad }), function (result) {
var loadedUsers = 0; var loadedUsers = 0;
@ -242,9 +243,11 @@ var UserList = {
}); });
if (result.data.length > 0) { if (result.data.length > 0) {
UserList.doSort(); UserList.doSort();
$('table+.loading').css('visibility', 'hidden');
} }
else { else {
UserList.noMoreEntries = true; UserList.noMoreEntries = true;
$('table+.loading').remove();
} }
UserList.offset += loadedUsers; UserList.offset += loadedUsers;
// animate // animate
@ -371,6 +374,7 @@ $(document).ready(function () {
OC.Router.registerLoadedCallback(function() { OC.Router.registerLoadedCallback(function() {
$(window).scroll(function(e) {UserList._onScroll(e);}); $(window).scroll(function(e) {UserList._onScroll(e);});
}); });
$('table').after($('<div class="loading" style="height: 200px; visibility: hidden;"></div>'));
$('select[multiple]').each(function (index, element) { $('select[multiple]').each(function (index, element) {
UserList.applyMultiplySelect($(element)); UserList.applyMultiplySelect($(element));