diff --git a/static/js/infoView.js b/static/js/infoView.js index 808bcfcc..0901cb75 100644 --- a/static/js/infoView.js +++ b/static/js/infoView.js @@ -347,6 +347,77 @@ pandora.ui.infoView = function(data, isMixed) { .appendTo($statistics); pandora.renderRightsLevel(that, $rightsLevel, data, isMixed, isMultiple, canEdit); + // User and Groups --------------------------------------------------------- + if (!isMultiple || pandora.hasCapability('canEditUsers')) { + + ['user', 'groups'].forEach(function(key) { + if (key == 'groups' && isMultiple) { + return + }; + var $input; + (canEdit || data[key] && data[key].length) && $('
') + .css({marginBottom: '4px'}) + .append(formatKey(key, 'statistics')) + .append( + $('
') + .css({margin: '2px 0 0 -1px'}) // fixme: weird + .append( + $input = Ox.Editable({ + placeholder: key == 'groups' + ? formatLight(Ox._(isMixed[key] ? 'Mixed Groups' : 'No Groups')) + : isMixed[key] ? formatLight(Ox._('Mixed Users')) : '', + editable: key == 'user' && canEdit, + tooltip: canEdit ? pandora.getEditTooltip() : '', + value: isMixed[key] + ? '' + : key == 'user' ? data[key] : data[key].join(', ') + }) + .bindEvent(Ox.extend({ + submit: function(event) { + editMetadata(key, event.value); + } + }, key == 'groups' ? { + doubleclick: canEdit ? function() { + setTimeout(function() { + if (window.getSelection) { + window.getSelection().removeAllRanges(); + } else if (document.selection) { + document.selection.empty(); + } + }); + pandora.$ui.groupsDialog = pandora.ui.groupsDialog({ + id: data.id, + name: data.title, + type: 'item' + }) + .bindEvent({ + groups: function(data) { + $input.options({ + value: data.groups.join(', ') + }); + } + }) + .open(); + } : function() {} + } : {})) + ) + ) + .appendTo($statistics); + }); + + // Created and Modified ---------------------------------------------------- + if (!isMultiple && canEdit) { + + ['created', 'modified'].forEach(function(key) { + $('
') + .css({marginBottom: '4px'}) + .append(formatKey(key, 'statistics')) + .append( + $('
').html(Ox.formatDate(data[key], '%B %e, %Y')) + ) + .appendTo($statistics); + }); + // Notes -------------------------------------------------------------------- if (canEdit) {