From b20a1989eedbbbc2b01d5cd4a613602dfbdff52c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20P=C3=A9ters?= Date: Fri, 30 May 2014 12:24:01 +0200 Subject: [PATCH] display document thumbnails on hover (#4731) --- src/pfwbged/theme/diazo_resources/static/main.css | 14 ++++++++++++++ src/pfwbged/theme/diazo_resources/static/main.js | 13 +++++++++++++ 2 files changed, 27 insertions(+) diff --git a/src/pfwbged/theme/diazo_resources/static/main.css b/src/pfwbged/theme/diazo_resources/static/main.css index f20f8e8..73133a6 100644 --- a/src/pfwbged/theme/diazo_resources/static/main.css +++ b/src/pfwbged/theme/diazo_resources/static/main.css @@ -831,3 +831,17 @@ tr.row-state-finished a[href$="/edit"] { box-shadow: none; } } + +#preview-doc { + position: fixed; + bottom: 2%; + right: 2%; + width: 30%; + z-index: 54321; + box-shadow: 0 2px 2px black; + background: white; +} + +#preview-doc img { + width: 100%; +} diff --git a/src/pfwbged/theme/diazo_resources/static/main.js b/src/pfwbged/theme/diazo_resources/static/main.js index 83b7f1f..e3619a6 100644 --- a/src/pfwbged/theme/diazo_resources/static/main.js +++ b/src/pfwbged/theme/diazo_resources/static/main.js @@ -42,4 +42,17 @@ $(function() { } return false; }); + $('.ResultsTasksTable tr a').hover(function() { + $('#preview-doc').remove(); + $.getJSON($(this).attr('href') + '/@@preview', + function (data) { + $('#preview-doc').remove(); + if (data.thumbnail_url) { + $('body').append('
'); + $('#preview-doc').append(''); + } + }); + }, function() { + $('#preview-doc').remove(); + }); });