diff --git a/public/css/admin.less b/public/css/admin.less index 0b928d1753..60ab6dafbe 100644 --- a/public/css/admin.less +++ b/public/css/admin.less @@ -147,7 +147,7 @@ > ul { padding-left: 0; - li { + > li { list-style-type: none; margin-bottom: 1em; padding: 1em; @@ -163,7 +163,7 @@ .members { padding: 1em; - li { + li[data-uid] { display: inline-block; border: 1px solid rgb(200, 200, 200); margin-right: 1em; @@ -175,6 +175,11 @@ span { padding: 0 1em; } + + &:hover { + .pointer; + background: rgba(192, 192, 192, 0.2); + } } } } diff --git a/public/src/forum/admin/groups.js b/public/src/forum/admin/groups.js index ccbabb01d7..88752da914 100644 --- a/public/src/forum/admin/groups.js +++ b/public/src/forum/admin/groups.js @@ -5,6 +5,9 @@ $(document).ready(function() { createNameEl = $('#create-group-name'), detailsModal = $('#group-details-modal'), detailsSearch = detailsModal.find('#group-details-search'), + searchResults = detailsModal.find('#group-details-search-results'), + groupMembersEl = detailsModal.find('ul.current_members'), + detailsModalSave = detailsModal.find('.btn-primary'), searchDelay = undefined, listEl = $('#groups-list'); @@ -66,28 +69,31 @@ $(document).ready(function() { var formEl = detailsModal.find('form'), nameEl = formEl.find('#change-group-name'), descEl = formEl.find('#change-group-desc'), - membersEl = formEl.find('ul.members'), memberIcon = document.createElement('li'), numMembers = groupObj.members.length, membersFrag = document.createDocumentFragment(), memberIconImg, x; - console.log(groupObj); nameEl.val(groupObj.name); descEl.val(groupObj.description); // Member list - memberIcon.innerHTML = ''; + memberIcon.innerHTML = ''; memberIconImg = memberIcon.querySelector('img'); + memberIconLabel = memberIcon.querySelector('span'); if (numMembers > 0) { for(x=0;x @@ -79,7 +79,8 @@
- +

Click on a user to remove them from the group

+
diff --git a/src/groups.js b/src/groups.js index 0cb4495f35..144cf98f4f 100644 --- a/src/groups.js +++ b/src/groups.js @@ -76,6 +76,12 @@ var async = require('async'), } else callback(new Error('group-exists')) }); }, + update: function(gid, values, callback) { + RDB.exists('gid:' + gid, function(err, exists) { + if (!err && exists) RDB.hmset('gid:' + gid, values, callback); + else calback(new Error('gid-not-found')); + }); + }, destroy: function(gid, callback) { RDB.hset('gid:' + gid, 'deleted', '1', callback); }, diff --git a/src/websockets.js b/src/websockets.js index 204330b356..0dbf3e5f32 100644 --- a/src/websockets.js +++ b/src/websockets.js @@ -822,6 +822,20 @@ var SocketIO = require('socket.io').listen(global.server, { callback(err ? err.message : null, groupObj || undefined); }); }); + + socket.on('api:groups.join', function(data, callback) { + Groups.join(data.gid, data.uid, callback); + }); + + socket.on('api:groups.leave', function(data, callback) { + Groups.leave(data.gid, data.uid, callback); + }); + + socket.on('api:groups.update', function(data, callback) { + Groups.update(data.gid, data.values, function(err) { + callback(err ? err.message : null); + }); + }); }); }(SocketIO));