support batch editing user

This commit is contained in:
j 2023-08-04 13:54:36 +02:00
parent a7e660a8da
commit 48aba7bde8

View file

@ -446,9 +446,12 @@ pandora.ui.infoView = function(data, isMixed) {
pandora.renderRightsLevel(that, $rightsLevel, data, isMixed, isMultiple, canEdit); pandora.renderRightsLevel(that, $rightsLevel, data, isMixed, isMultiple, canEdit);
// User and Groups --------------------------------------------------------- // User and Groups ---------------------------------------------------------
if (!isMultiple) { if (!isMultiple || pandora.hasCapability('canEditUsers')) {
['user', 'groups'].forEach(function(key) { ['user', 'groups'].forEach(function(key) {
if (key == 'groups' && isMultiple) {
return
};
var $input; var $input;
(canEdit || data[key] && data[key].length) && $('<div>') (canEdit || data[key] && data[key].length) && $('<div>')
.css({marginBottom: '4px'}) .css({marginBottom: '4px'})
@ -458,10 +461,14 @@ pandora.ui.infoView = function(data, isMixed) {
.css({margin: '2px 0 0 -1px'}) // fixme: weird .css({margin: '2px 0 0 -1px'}) // fixme: weird
.append( .append(
$input = Ox.Editable({ $input = Ox.Editable({
placeholder: key == 'groups' ? formatLight(Ox._(isMixed[key] ? 'Mixed Groups' : 'No Groups')) : '', placeholder: key == 'groups'
? formatLight(Ox._(isMixed[key] ? 'Mixed Groups' : 'No Groups'))
: isMixed[key] ? formatLight(Ox._('Mixed Users')) : '',
editable: key == 'user' && canEdit, editable: key == 'user' && canEdit,
tooltip: canEdit ? pandora.getEditTooltip() : '', tooltip: canEdit ? pandora.getEditTooltip() : '',
value: key == 'user' ? data[key] : isMixed[key] ? '' : data[key].join(', ') value: isMixed[key]
? ''
: key == 'user' ? data[key] : data[key].join(', ')
}) })
.bindEvent(Ox.extend({ .bindEvent(Ox.extend({
submit: function(event) { submit: function(event) {