From a584022ecc7f186386a748122a84e21615e29399 Mon Sep 17 00:00:00 2001 From: Arthur Schiwon Date: Sat, 5 Jul 2014 01:21:18 +0200 Subject: [PATCH] increment group counters when a user is created --- settings/js/users/groups.js | 4 ++++ settings/js/users/users.js | 10 ++++++++-- settings/templates/users/part.grouplist.php | 2 +- 3 files changed, 13 insertions(+), 3 deletions(-) diff --git a/settings/js/users/groups.js b/settings/js/users/groups.js index dcaf593b886..c3e3d1a50c9 100644 --- a/settings/js/users/groups.js +++ b/settings/js/users/groups.js @@ -34,6 +34,10 @@ GroupList = { $groupLiElement.find('.usercount').text(usercount); }, + getUserCount: function ($groupLiElement) { + return parseInt($groupLiElement.data('usercount'), 10); + }, + getCurrentGID: function () { return GroupList.activeGID; }, diff --git a/settings/js/users/users.js b/settings/js/users/users.js index f84d67b75bc..170a4bd89da 100644 --- a/settings/js/users/users.js +++ b/settings/js/users/users.js @@ -91,8 +91,8 @@ var UserList = { } $tdLastLogin = $tr.find('td.lastLogin'); $tdLastLogin.text(lastLoginRel); - //tooltip makes it complicated … to not insert new HTML, we adjust the - //original title. We use a temporary div to get back the html that we + //tooltip makes it complicated … to not insert new HTML, we adjust the + //original title. We use a temporary div to get back the html that we //can pass later. It is also required to initialise tipsy. var tooltip = $('
').html($($tdLastLogin.attr('original-title')).text(lastLoginAbs)).html(); $tdLastLogin.tipsy({gravity:'s', fade:true, html:true}); @@ -602,6 +602,12 @@ $(document).ready(function () { if (result.data.groups) { var addedGroups = result.data.groups; UserList.availableGroups = $.unique($.merge(UserList.availableGroups, addedGroups)); + for (i in result.data.groups) { + var gid = result.data.groups[i]; + $li = GroupList.getGroupLI(gid); + userCount = GroupList.getUserCount($li); + GroupList.setUserCount($li, userCount + 1); + } } if (result.data.homeExists){ OC.Notification.hide(); diff --git a/settings/templates/users/part.grouplist.php b/settings/templates/users/part.grouplist.php index 28f2236b1d7..588c2e6202c 100644 --- a/settings/templates/users/part.grouplist.php +++ b/settings/templates/users/part.grouplist.php @@ -27,7 +27,7 @@ -
  • +
  • t('Admins')); ?> 0) { p($adminGroup['usercount']); } ?> -- 2.39.5