diff --git a/pandora/0xdb.jsonc b/pandora/0xdb.jsonc index 09c2d061..ec02b8db 100644 --- a/pandora/0xdb.jsonc +++ b/pandora/0xdb.jsonc @@ -20,7 +20,6 @@ "canEditUsers": {"admin": true}, "canPlayClips": {"guest": 2, "member": 2, "friend": 4, "staff": 4, "admin": 4}, "canPlayVideo": {"guest": 1, "member": 1, "friend": 4, "staff": 4, "admin": 4}, - "canReloadMetadata": {"staff": true, "admin": true}, "canSeeDebugMenu": {"staff": true, "admin": true}, "canSeeFiles": {"staff": true, "admin": true}, "canSeeItem": {"guest": 3, "member": 3, "friend": 4, "staff": 4, "admin": 4}, diff --git a/static/js/pandora/infoView.js b/static/js/pandora/infoView.js index dbf6d181..0141ee8e 100644 --- a/static/js/pandora/infoView.js +++ b/static/js/pandora/infoView.js @@ -141,7 +141,8 @@ pandora.ui.infoView = function(data) { format: function(value) { return formatTitle(value); }, - tooltip: isEditable ? 'Doubleclick to edit' : '', + tooltip: isEditable ? 'Doubleclick to edit' + : canEdit ? 'Doubleclick to reload metadata' : '', value: data.title }) .css({ @@ -151,11 +152,13 @@ pandora.ui.infoView = function(data) { MozUserSelect: 'text', WebkitUserSelect: 'text' }) - .bindEvent({ + .bindEvent(Ox.extend({ submit: function(event) { editMetadata('title', event.value); } - }) + }, !isEditable && canEdit ? { + doubleclick: reloadMetadata + } : {})) .appendTo($text) ) .appendTo($text); @@ -176,7 +179,8 @@ pandora.ui.infoView = function(data) { ? formatValue(value.split(', '), 'name') : formatLight('Unknown Director'); }, - tooltip: isEditable ? 'Doubleclick to edit' : '', + tooltip: isEditable ? 'Doubleclick to edit' + : canEdit ? 'Doubleclick to reload metadata' : '', value: data.director ? data.director.join(', ') : 'Unknown Director' }) .css({ @@ -186,11 +190,13 @@ pandora.ui.infoView = function(data) { MozUserSelect: 'text', WebkitUserSelect: 'text' }) - .bindEvent({ + .bindEvent(Ox.extend({ submit: function(event) { editMetadata('director', event.value); } - }) + }, !isEditable && canEdit ? { + doubleclick: reloadMetadata + } : {})) ) .appendTo($text); } @@ -564,6 +570,21 @@ pandora.ui.infoView = function(data) { return data; } + function reloadMetadata() { + var item = ui.item; + // fixme: maybe there's a better method name for this? + pandora.api.updateExternalData({ + id: ui.item + }, function(result) { + Ox.Request.clearCache(item); + if (ui.item == item && ui.itemView == 'info') { + pandora.$ui.contentPanel.replaceElement( + 1, pandora.$ui.item = pandora.ui.item() + ); + } + }); + } + function renderCapabilities(rightsLevel) { var capabilities = Ox.merge( canEdit ? [{name: 'canSeeItem', symbol: 'Find'}] : [], diff --git a/static/js/pandora/toolbar.js b/static/js/pandora/toolbar.js index 04b461e0..be7d9f27 100644 --- a/static/js/pandora/toolbar.js +++ b/static/js/pandora/toolbar.js @@ -23,33 +23,6 @@ pandora.ui.toolbar = function() { pandora.$ui.orderButton = pandora.ui.orderButton() ); } - if ( - ui.item && ui.itemView == 'info' - && pandora.site.capabilities.canReloadMetadata[pandora.user.level] - ) { - that.append( - Ox.Button({ - title: 'Reload Metadata' - }) - .css({float: 'left', margin: '4px'}) - .bindEvent({ - click: function() { - var item = ui.item; - // fixme: maybe there's a better method name for this? - pandora.api.updateExternalData({ - id: ui.item - }, function(result) { - Ox.Request.clearCache(item); - if (ui.item == item && ui.itemView == 'info') { - pandora.$ui.contentPanel.replaceElement( - 1, pandora.$ui.item = pandora.ui.item() - ); - } - }); - } - }) - ); - } that.append( pandora.$ui.findElement = pandora.ui.findElement() );