mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-10 16:05:49 +01:00
closes #992
This commit is contained in:
@@ -58,14 +58,15 @@ define(function() {
|
|||||||
|
|
||||||
listEl.on('click', 'button[data-action]', function() {
|
listEl.on('click', 'button[data-action]', function() {
|
||||||
var action = this.getAttribute('data-action'),
|
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) {
|
switch (action) {
|
||||||
case 'delete':
|
case 'delete':
|
||||||
bootbox.confirm('Are you sure you wish to delete this group?', function(confirm) {
|
bootbox.confirm('Are you sure you wish to delete this group?', function(confirm) {
|
||||||
if (confirm) {
|
if (confirm) {
|
||||||
socket.emit('admin.groups.delete', gid, function(err, data) {
|
socket.emit('admin.groups.delete', gid, function(err, data) {
|
||||||
console.log(err, data);
|
|
||||||
if(err) {
|
if(err) {
|
||||||
return app.alertError(err.message);
|
return app.alertError(err.message);
|
||||||
}
|
}
|
||||||
@@ -106,6 +107,8 @@ define(function() {
|
|||||||
|
|
||||||
detailsModal.attr('data-gid', groupObj.gid);
|
detailsModal.attr('data-gid', groupObj.gid);
|
||||||
detailsModal.modal('show');
|
detailsModal.modal('show');
|
||||||
|
|
||||||
|
$('.hide-if-system')[system ? 'hide' : 'show']();
|
||||||
});
|
});
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
<div class="groups">
|
<div class="groups">
|
||||||
<ul id="groups-list">
|
<ul id="groups-list">
|
||||||
<!-- BEGIN groups -->
|
<!-- BEGIN groups -->
|
||||||
<li data-gid="{groups.gid}">
|
<li data-gid="{groups.gid}" data-system="{groups.hidden}">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-lg-8">
|
<div class="col-lg-8">
|
||||||
<h2>{groups.name}</h2>
|
<h2>{groups.name}</h2>
|
||||||
@@ -69,7 +69,7 @@
|
|||||||
<div class="modal-body">
|
<div class="modal-body">
|
||||||
<div class="alert alert-danger hide" id="create-modal-error"></div>
|
<div class="alert alert-danger hide" id="create-modal-error"></div>
|
||||||
<form>
|
<form>
|
||||||
<div class="form-group">
|
<div class="form-group hide-if-system">
|
||||||
<label for="group-name">Group Name</label>
|
<label for="group-name">Group Name</label>
|
||||||
<input type="text" class="form-control" id="change-group-name" placeholder="Group Name" />
|
<input type="text" class="form-control" id="change-group-name" placeholder="Group Name" />
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -13,14 +13,16 @@
|
|||||||
expand: options.expand
|
expand: options.expand
|
||||||
}, next);
|
}, next);
|
||||||
}, function (err, groups) {
|
}, function (err, groups) {
|
||||||
// Remove deleted and hidden groups from this list
|
groups.forEach(function(group, g, arr) {
|
||||||
callback(err, groups.filter(function (group) {
|
if (parseInt(group.deleted, 10) === 1) {
|
||||||
if (parseInt(group.deleted, 10) === 1 || parseInt(group.hidden, 10) === 1) {
|
delete arr[g];
|
||||||
return false;
|
|
||||||
} else {
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
}));
|
if (parseInt(group.hidden, 10) === 1) {
|
||||||
|
group.deletable = 0;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
callback(err, groups);
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
callback(null, []);
|
callback(null, []);
|
||||||
|
|||||||
Reference in New Issue
Block a user