add remove user from group confirmation

Added confirmation request when removing user from a group.
v1.18.x
Josh 11 years ago
parent 663aff4b24
commit f14ad11dd0

@ -2,7 +2,8 @@ define(function() {
var Groups = {}; var Groups = {};
Groups.init = function() { Groups.init = function() {
var createEl = document.getElementById('create'), var yourid = templates.get('yourid'),
createEl = document.getElementById('create'),
createModal = $('#create-modal'), createModal = $('#create-modal'),
createSubmitBtn = document.getElementById('create-modal-go'), createSubmitBtn = document.getElementById('create-modal-go'),
createNameEl = $('#create-group-name'), createNameEl = $('#create-group-name'),
@ -171,13 +172,16 @@ define(function() {
groupMembersEl.on('click', 'li[data-uid]', function() { groupMembersEl.on('click', 'li[data-uid]', function() {
var uid = this.getAttribute('data-uid'), var uid = this.getAttribute('data-uid'),
gid = detailsModal.attr('data-gid'); gid = detailsModal.attr('data-gid');
bootbox.confirm('Are you sure you want to remove this user?', function(confirm) {
socket.emit('admin.groups.leave', { if (confirm){
gid: gid, socket.emit('admin.groups.leave', {
uid: uid gid: gid,
}, function(err, data) { uid: uid
if (!err) { }, function(err, data) {
groupMembersEl.find('li[data-uid="' + uid + '"]').remove(); if (!err) {
groupMembersEl.find('li[data-uid="' + uid + '"]').remove();
}
});
} }
}); });
}); });

@ -96,3 +96,4 @@
</div> </div>
</div> </div>
</div> </div>
<input type="hidden" template-variable="yourid" value="{yourid}" />

@ -429,7 +429,8 @@ var nconf = require('nconf'),
expand: true expand: true
}, function (err, groups) { }, function (err, groups) {
res.json(200, { res.json(200, {
groups: groups groups: groups,
yourid: req.user.uid
}); });
}); });
}); });

Loading…
Cancel
Save