mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-10 07:55:46 +01:00
closes #992
This commit is contained in:
@@ -58,14 +58,15 @@ define(function() {
|
||||
|
||||
listEl.on('click', 'button[data-action]', function() {
|
||||
var action = this.getAttribute('data-action'),
|
||||
gid = $(this).parents('li[data-gid]').attr('data-gid');
|
||||
parent = $(this).parents('li[data-gid]'),
|
||||
gid = parent.attr('data-gid'),
|
||||
system = parseInt(parent.attr('data-system'), 10) === 1;
|
||||
|
||||
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);
|
||||
}
|
||||
@@ -106,6 +107,8 @@ 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}">
|
||||
<li data-gid="{groups.gid}" data-system="{groups.hidden}">
|
||||
<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">
|
||||
<div class="form-group hide-if-system">
|
||||
<label for="group-name">Group Name</label>
|
||||
<input type="text" class="form-control" id="change-group-name" placeholder="Group Name" />
|
||||
</div>
|
||||
|
||||
@@ -13,14 +13,16 @@
|
||||
expand: options.expand
|
||||
}, next);
|
||||
}, function (err, groups) {
|
||||
// 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;
|
||||
groups.forEach(function(group, g, arr) {
|
||||
if (parseInt(group.deleted, 10) === 1) {
|
||||
delete arr[g];
|
||||
}
|
||||
}));
|
||||
if (parseInt(group.hidden, 10) === 1) {
|
||||
group.deletable = 0;
|
||||
}
|
||||
});
|
||||
|
||||
callback(err, groups);
|
||||
});
|
||||
} else {
|
||||
callback(null, []);
|
||||
|
||||
Reference in New Issue
Block a user