category permission page fixes

v1.18.x
Baris Soner Usakli 11 years ago
parent 7bb3766ebd
commit dbb814fe4e

@ -252,6 +252,7 @@ define(['uploader'], function(uploader) {
var numResults = results.length, var numResults = results.length,
resultObj; resultObj;
resultsEl.html('');
for(var x = 0; x < numResults; x++) { for(var x = 0; x < numResults; x++) {
resultObj = results[x]; resultObj = results[x];
liEl = $('<li />') liEl = $('<li />')
@ -348,12 +349,14 @@ define(['uploader'], function(uploader) {
readMembers = modalEl.find('#category-permissions-read'), readMembers = modalEl.find('#category-permissions-read'),
writeMembers = modalEl.find('#category-permissions-write'), writeMembers = modalEl.find('#category-permissions-write'),
moderatorsEl = modalEl.find('#category-permissions-mods'); moderatorsEl = modalEl.find('#category-permissions-mods');
socket.emit('admin.categories.getPrivilegeSettings', cid, function(err, privilegeList) { socket.emit('admin.categories.getPrivilegeSettings', cid, function(err, privilegeList) {
var readLength = privilegeList['+r'].length, var readLength = privilegeList['+r'].length,
writeLength = privilegeList['+w'].length, writeLength = privilegeList['+w'].length,
modLength = privilegeList['mods'].length, modLength = privilegeList['mods'].length,
liEl, x, userObj; liEl, x, userObj;
readMembers.html('');
if (readLength > 0) { if (readLength > 0) {
for(x = 0; x < readLength; x++) { for(x = 0; x < readLength; x++) {
userObj = privilegeList['+r'][x]; userObj = privilegeList['+r'][x];
@ -365,10 +368,11 @@ define(['uploader'], function(uploader) {
readMembers.append(liEl); readMembers.append(liEl);
} }
writeMembers.html('');
if (writeLength > 0) { if (writeLength > 0) {
for(x=0;x<writeLength;x++) { for(x=0;x<writeLength;x++) {
userObj = privilegeList['+w'][x]; userObj = privilegeList['+w'][x];
$('<li />').attr('data-uid', userObj.uid).html('<img src="' + userObj.picture + '" title="' + userObj.username + '" />'); liEl = $('<li />').attr('data-uid', userObj.uid).html('<img src="' + userObj.picture + '" title="' + userObj.username + '" />');
writeMembers.append(liEl); writeMembers.append(liEl);
} }
} else { } else {
@ -376,6 +380,7 @@ define(['uploader'], function(uploader) {
writeMembers.append(liEl); writeMembers.append(liEl);
} }
moderatorsEl.html('');
if (modLength > 0) { if (modLength > 0) {
for(x = 0;x < modLength; x++) { for(x = 0;x < modLength; x++) {
userObj = privilegeList['mods'][x]; userObj = privilegeList['mods'][x];
@ -384,7 +389,7 @@ define(['uploader'], function(uploader) {
} }
} else { } else {
liEl = $('<li />').addClass('empty').html('No moderators'); liEl = $('<li />').addClass('empty').html('No moderators');
moderatorsEl.appendChild(liEl); moderatorsEl.append(liEl);
} }
}); });
}; };

Loading…
Cancel
Save