diff options
author | Arthur Schiwon <blizzz@owncloud.com> | 2014-04-15 00:13:23 +0200 |
---|---|---|
committer | Arthur Schiwon <blizzz@owncloud.com> | 2014-06-02 12:53:55 +0200 |
commit | 249e42c4cdf81c2d1c294a5535c055cdfee992b4 (patch) | |
tree | 07d884e082eb686aa93de67693a3296a4c8c08d8 /settings/js/users/groups.js | |
parent | dbc854d8b8cb0a187859fae174a41de5b296595c (diff) | |
download | nextcloud-server-249e42c4cdf81c2d1c294a5535c055cdfee992b4.tar.gz nextcloud-server-249e42c4cdf81c2d1c294a5535c055cdfee992b4.zip |
enable group filtering
Diffstat (limited to 'settings/js/users/groups.js')
-rw-r--r-- | settings/js/users/groups.js | 49 |
1 files changed, 46 insertions, 3 deletions
diff --git a/settings/js/users/groups.js b/settings/js/users/groups.js index 0180cb64898..1088467ca11 100644 --- a/settings/js/users/groups.js +++ b/settings/js/users/groups.js @@ -6,17 +6,22 @@ */ var GroupList = { - addGroup: function(gid) { + addGroup: function(gid, usercount) { + if(usercount === undefined || usercount === 0) { + usercount = ''; + } var li = $('li[data-gid]').last().clone(); var ul = $('li[data-gid]').first().parent(); li.attr('data-gid', gid); - li.attr('data-usercount', 0); + li.attr('data-usercount', usercount); li.find('a span').first().text(gid); - li.find('span[class=usercount]').first().text(''); + li.find('span[class=usercount]').first().text(usercount); $(li).appendTo(ul); GroupList.sortGroups(0); + + return li; }, sortGroups: function(usercount) { @@ -75,6 +80,41 @@ ) }, + update: function() { + if (GroupList.updating) { + return; + } + GroupList.updating = true; + pattern = filter.getPattern(); + var query = $.param({ pattern: pattern }); + $.get(OC.generateUrl('/settings/ajax/grouplist') + '?' + query, function (result) { + var lis = []; + if (result.status === 'success') { + $.each(result.data, function (i, subset) { + $.each(subset, function (index, group) { + if($('li[data-gid="' + group.name + '"]').length > 0) { + return true; + } + var li = GroupList.addGroup(group.name, group.usercount); + li.addClass('appear transparent'); + lis.push(li); + }); + }); + if (result.data.length > 0) { + GroupList.doSort(); + } else { + GroupList.noMoreEntries = true; + } + setTimeout(function() { + for (var i = 0; i < lis.length; i++) { + lis[i].removeClass('transparent'); + } + }, 0); + } + GroupList.updating = false; + }); + }, + elementBelongsToAddGroup: function(el) { return !(el !== $('#newgroup-form').get(0) && $('#newgroup-form').find($(el)).length === 0); @@ -134,6 +174,9 @@ remove: function(gid) { $('li').filterAttr('data-gid', gid).remove(); }, + empty: function() { + $('li:not([data-gid=""])').remove(); + }, initDeleteHandling: function() { //set up handler GroupDeleteHandler = new DeleteHandler('removegroup.php', 'groupname', |