From 2220dd1a6c6d090410118abe86f95e0c303a856f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFs=20Poujade?= <lois.poujade@tetras-libre.fr> Date: Wed, 15 Jun 2022 09:41:03 +0200 Subject: [PATCH] Fix file thumbnail & add download link Closes #16 --- capsule-prototype/css/popup.css | 4 ++-- capsule-prototype/js/PopupPanelWidget.js | 10 +++++++++- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/capsule-prototype/css/popup.css b/capsule-prototype/css/popup.css index 9c5a4fa..444a3bc 100644 --- a/capsule-prototype/css/popup.css +++ b/capsule-prototype/css/popup.css @@ -611,7 +611,7 @@ color: rgba(255,255,255,.75); /*#FFF; */ } -#popupEditSupprimer, #editAnnotationPic, #linkToOriginalImage { +#popupEditSupprimer, #editAnnotationPic, #linkToOriginalImage, #popupEditDownload { font-weight: 400; color: rgba(255,255,255,.75); font-size: 0.6em; @@ -629,7 +629,7 @@ color: rgba(255,255,255,.75); /*#FFF; */ border: 1px solid rgba(255,255,255,.15); } -#popupEditSupprimer:hover { +#popupEditSupprimer:hover, #popupEditDownload:hover { background: rgba(255,255,255,.05); color: #fff } diff --git a/capsule-prototype/js/PopupPanelWidget.js b/capsule-prototype/js/PopupPanelWidget.js index 9da3763..1e2424e 100644 --- a/capsule-prototype/js/PopupPanelWidget.js +++ b/capsule-prototype/js/PopupPanelWidget.js @@ -866,7 +866,7 @@ PopupPanelWidget.prototype.createPopupContent = function (tag) { else if (type.indexOf("video") > -1) image.attr("src", "../shared/css/images/img-video.png") else if (type.indexOf("msword") > -1) image.attr("src", "../shared/css/images/img-word.png") else if (type.indexOf("link") > -1) image.attr("src", "../shared/css/images/img-link.png") - else $("#popupImg").attr("src", "../shared/css/images/img-document.png"); + else image.attr("src", "../shared/css/images/img-document.png") } image @@ -916,6 +916,14 @@ PopupPanelWidget.prototype.createPopupContent = function (tag) { imageBoxDiv.append(displayOriginalImage); } popupLeftDiv.append(imageBoxDiv); + let downloadElement = $('<a>'); + downloadElement + .html("Download File") + .addClass('popupLeftItem') + .attr('id', 'popupEditDownload') + .attr('href', fileDirectLink) + .attr('download', this.getMetadata('File->File Name')); + popupLeftDiv.append(downloadElement); if (popupPanelWidget.canEdit()) { let deleteElement = $('<div>'); -- GitLab