display document thumbnails on hover (#4731)

This commit is contained in:
Frédéric Péters 2014-05-30 12:24:01 +02:00
parent 9fad11a391
commit b20a1989ee
2 changed files with 27 additions and 0 deletions

View File

@ -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%;
}

View File

@ -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('<div id="preview-doc">');
$('#preview-doc').append('<img src="' + data.thumbnail_url + '"/>');
}
});
}, function() {
$('#preview-doc').remove();
});
});