0xdb info view: make 'reload metadata' a button

This commit is contained in:
rolux 2012-10-10 08:15:30 +00:00
parent 22e7dc7421
commit 37ee7a1267

View file

@ -114,18 +114,13 @@ pandora.ui.infoView = function(data) {
}) })
.appendTo($reflection), .appendTo($reflection),
$text = Ox.Element({ $text = Ox.Element()
tooltip: canEdit && !isEditable ? 'Doubleclick to reload metadata' : ''
})
.css({ .css({
position: 'absolute', position: 'absolute',
left: margin + (iconSize == 256 ? 256 : iconWidth) + margin + 'px', left: margin + (iconSize == 256 ? 256 : iconWidth) + margin + 'px',
top: margin + 'px', top: margin + 'px',
right: margin + statisticsWidth + margin + 'px' right: margin + statisticsWidth + margin + 'px'
}) })
.bindEvent(canEdit && !isEditable ? {
doubleclick: reloadMetadata
} : {})
.appendTo($data.$element), .appendTo($data.$element),
$statistics = $('<div>') $statistics = $('<div>')
@ -137,6 +132,8 @@ pandora.ui.infoView = function(data) {
}) })
.appendTo($data.$element), .appendTo($data.$element),
$reloadButton,
$capabilities, $capabilities,
$browserImages = []; $browserImages = [];
@ -454,6 +451,18 @@ pandora.ui.infoView = function(data) {
$('<div>').css({height: '16px'}).appendTo($text); $('<div>').css({height: '16px'}).appendTo($text);
if (canEdit && !isEditable) {
$reloadButton = Ox.Button({
title: 'Reload Metadata',
width: 128
})
.css({marginBottom: '4px'})
.bindEvent({
click: reloadMetadata
})
.appendTo($statistics);
}
// Mainstream Score, Arthouse Score ---------------------------------------- // Mainstream Score, Arthouse Score ----------------------------------------
['votes', 'likes'].forEach(function(key) { ['votes', 'likes'].forEach(function(key) {
@ -629,6 +638,7 @@ pandora.ui.infoView = function(data) {
function reloadMetadata() { function reloadMetadata() {
var item = ui.item; var item = ui.item;
// fixme: maybe there's a better method name for this? // fixme: maybe there's a better method name for this?
$reloadButton.options({disabled: true, title: 'Reloading Metadata'});
pandora.api.updateExternalData({ pandora.api.updateExternalData({
id: ui.item id: ui.item
}, function(result) { }, function(result) {