diff options
author | Robin McCorkell <rmccorkell@karoshi.org.uk> | 2014-12-18 00:47:17 +0000 |
---|---|---|
committer | Robin McCorkell <rmccorkell@karoshi.org.uk> | 2014-12-18 00:47:17 +0000 |
commit | a341f96f9117d38a476a555a3ba07e38a0088afa (patch) | |
tree | d7436ff78e8b588a812a6540a10730395596c46d /settings | |
parent | 619dcae7af6293c84931b231981dd369e5bcafb4 (diff) | |
parent | d3fe780805f572951f619818920746df1d42466b (diff) | |
download | nextcloud-server-a341f96f9117d38a476a555a3ba07e38a0088afa.tar.gz nextcloud-server-a341f96f9117d38a476a555a3ba07e38a0088afa.zip |
Merge pull request #12820 from owncloud/user-management-on-large-screens
fix initial loading limit of user management on large screens
Diffstat (limited to 'settings')
-rw-r--r-- | settings/js/users/users.js | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/settings/js/users/users.js b/settings/js/users/users.js index 62e18d1be04..d910e1ec129 100644 --- a/settings/js/users/users.js +++ b/settings/js/users/users.js @@ -353,10 +353,13 @@ var UserList = { UserDeleteHandler.deleteEntry(); }); }, - update: function (gid) { + update: function (gid, limit) { if (UserList.updating) { return; } + if(!limit) { + limit = UserList.usersToLoad; + } $userList.siblings('.loading').css('visibility', 'visible'); UserList.updating = true; if(gid === undefined) { @@ -366,7 +369,7 @@ var UserList = { var pattern = filter.getPattern(); $.get( OC.generateUrl('/settings/users/users'), - { offset: UserList.offset, limit: UserList.usersToLoad, gid: gid, pattern: pattern }, + { offset: UserList.offset, limit: limit, gid: gid, pattern: pattern }, function (result) { var loadedUsers = 0; var trs = []; @@ -385,6 +388,8 @@ var UserList = { if (result.length > 0) { UserList.doSort(); $userList.siblings('.loading').css('visibility', 'hidden'); + // reset state on load + UserList.noMoreEntries = false; } else { UserList.noMoreEntries = true; @@ -537,7 +542,7 @@ var UserList = { return; } if (UserList.scrollArea.scrollTop() + UserList.scrollArea.height() > UserList.scrollArea.get(0).scrollHeight - 500) { - UserList.update(UserList.currentGid, true); + UserList.update(UserList.currentGid); } }, @@ -770,7 +775,14 @@ $(document).ready(function () { } }); + // calculate initial limit of users to load + var initialUserCountLimit = 20, + containerHeight = $('#app-content').height(); + if(containerHeight > 40) { + initialUserCountLimit = Math.floor(containerHeight/40); + } + // trigger loading of users on startup - UserList.update(UserList.currentGid); + UserList.update(UserList.currentGid, initialUserCountLimit); }); |