From 4c59d4149693aa9ad06e94560463f55599262fa2 Mon Sep 17 00:00:00 2001 From: rolux Date: Fri, 6 Feb 2015 06:23:43 +0000 Subject: [PATCH] fix #2590 (layout issue with document thumbnail image) --- static/js/documentsPanel.js | 43 ++++++++++++++++++++++--------------- 1 file changed, 26 insertions(+), 17 deletions(-) diff --git a/static/js/documentsPanel.js b/static/js/documentsPanel.js index c2670425e..45e30efa9 100644 --- a/static/js/documentsPanel.js +++ b/static/js/documentsPanel.js @@ -777,23 +777,32 @@ pandora.ui.documentsPanel = function(options) { function renderPreview() { var selected = $list.options('selected')[0], size = getPreviewSize(), - src = '/documents/' + selected + '/256p.jpg'; - return Ox.ImageElement({ - height: size.height, - src: src, - // fixme: this tends to stick around after menu click - // (and may not be necessary in the first place) - // tooltip: Ox._('Click to open document'), - width: size.width - }) - .css({ - borderRadius: '8px', - margin: size.margin, - cursor: 'pointer' - }) - .on({ - click: openDocuments - }); + src = '/documents/' + selected + '/256p.jpg', + $element = Ox.ImageElement({ + height: size.height, + src: src, + // fixme: this tends to stick around after menu click + // (and may not be necessary in the first place) + // tooltip: Ox._('Click to open document'), + width: size.width + }) + .css({ + borderRadius: '8px', + margin: size.margin, + }) + .on({ + click: function(e) { + if ($(e.target).is('img')) { + openDocuments(); + } + } + }) + .bindEvent({ + load: function() { + $($element.children()[0]).css({cursor: 'pointer'}); + } + }); + return $element; } function resizeItem() {