Baris Soner Usakli 11 years ago
commit ab60da30da

@ -58,15 +58,14 @@ define(function() {
listEl.on('click', 'button[data-action]', function() {
var action = this.getAttribute('data-action'),
parent = $(this).parents('li[data-gid]'),
gid = parent.attr('data-gid'),
system = parseInt(parent.attr('data-system'), 10) === 1;
gid = $(this).parents('li[data-gid]').attr('data-gid');
switch (action) {
case 'delete':
bootbox.confirm('Are you sure you wish to delete this group?', function(confirm) {
if (confirm) {
socket.emit('admin.groups.delete', gid, function(err, data) {
console.log(err, data);
if(err) {
return app.alertError(err.message);
}
@ -107,8 +106,6 @@ define(function() {
detailsModal.attr('data-gid', groupObj.gid);
detailsModal.modal('show');
$('.hide-if-system')[system ? 'hide' : 'show']();
});
break;
}

@ -5,7 +5,7 @@
<div class="groups">
<ul id="groups-list">
<!-- BEGIN groups -->
<li data-gid="{groups.gid}" data-system="{groups.hidden}">
<li data-gid="{groups.gid}">
<div class="row">
<div class="col-lg-8">
<h2>{groups.name}</h2>
@ -69,7 +69,7 @@
<div class="modal-body">
<div class="alert alert-danger hide" id="create-modal-error"></div>
<form>
<div class="form-group hide-if-system">
<div class="form-group">
<label for="group-name">Group Name</label>
<input type="text" class="form-control" id="change-group-name" placeholder="Group Name" />
</div>

@ -13,16 +13,14 @@
expand: options.expand
}, next);
}, function (err, groups) {
groups.forEach(function(group, g, arr) {
if (parseInt(group.deleted, 10) === 1) {
delete arr[g];
}
if (parseInt(group.hidden, 10) === 1) {
group.deletable = 0;
// Remove deleted and hidden groups from this list
callback(err, groups.filter(function (group) {
if (parseInt(group.deleted, 10) === 1 || parseInt(group.hidden, 10) === 1) {
return false;
} else {
return true;
}
});
callback(err, groups);
}));
});
} else {
callback(null, []);

Loading…
Cancel
Save