From 443c1db3a34050b19dd83ef2214035bd14679279 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Calvi=C3=B1o=20S=C3=A1nchez?= Date: Thu, 27 Jun 2019 12:14:27 +0200 Subject: [PATCH 1/2] Fix download link included in public share page with hidden download MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The preview element in the public share page was always wrapped with a link to download the file; now that link is included only if the "Hide download" option of the share is not enabled. Signed-off-by: Daniel Calviño Sánchez --- apps/files_sharing/js/public.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/apps/files_sharing/js/public.js b/apps/files_sharing/js/public.js index 08b7af356f..fe59f2ce52 100644 --- a/apps/files_sharing/js/public.js +++ b/apps/files_sharing/js/public.js @@ -136,9 +136,11 @@ OCA.Sharing.PublicApp = { scalingup: 0 }; - var imgcontainer = $(''); - var img = imgcontainer.find('.publicpreview'); + var imgcontainer = $(''); + if (hideDownload === 'false') { + imgcontainer = $('').append(imgcontainer); + } + var img = imgcontainer.hasClass('publicpreview')? imgcontainer: imgcontainer.find('.publicpreview'); img.css({ 'max-width': previewWidth, 'max-height': previewHeight From a8323bbc0536ee82b9f7d852a34bf266125d2033 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Calvi=C3=B1o=20S=C3=A1nchez?= Date: Thu, 27 Jun 2019 13:33:22 +0200 Subject: [PATCH 2/2] Fix placement of icon in public share page for audio files MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When the preview for audio files is used an HTML 5 audio element is shown in the public share page. This element is added by the template, so it is already there when the mimetype icon is added to the "#imgframe" element. Instead of appended the icon is now prepended, so it appears before the audio element (prepending instead of appending should make no difference for other types of files, as in that case the "#imgframe" element is empty). Besides that, the CSS was modified to show the icon centered above the audio preview instead of next to it. Signed-off-by: Daniel Calviño Sánchez --- apps/files_sharing/css/public.scss | 6 ++++++ apps/files_sharing/js/public.js | 5 ++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/apps/files_sharing/css/public.scss b/apps/files_sharing/css/public.scss index 83cba309da..b2456baeeb 100644 --- a/apps/files_sharing/css/public.scss +++ b/apps/files_sharing/css/public.scss @@ -25,6 +25,12 @@ max-width: 100% !important; } +#imgframe audio { + display: block; + margin-left: auto; + margin-right: auto; +} + #imgframe .text-preview { display: inline-block; position: relative; diff --git a/apps/files_sharing/js/public.js b/apps/files_sharing/js/public.js index fe59f2ce52..b4f76ca067 100644 --- a/apps/files_sharing/js/public.js +++ b/apps/files_sharing/js/public.js @@ -177,7 +177,10 @@ OCA.Sharing.PublicApp = { } else if (mimetype.substr(0, mimetype.indexOf('/')) !== 'video') { img.attr('src', mimetypeIcon); img.attr('width', 128); - imgcontainer.appendTo('#imgframe'); + // "#imgframe" is either empty or it contains an audio preview that + // the icon should appear before, so the container should be + // prepended to the frame. + imgcontainer.prependTo('#imgframe'); } else if (previewSupported === 'true') { $('#imgframe > video').attr('poster', OC.generateUrl('/apps/files_sharing/publicpreview/' + token + '?' + OC.buildQueryString(params)));