From 2e28a7559f4acfed9df042d0a582a67bbcfc27e4 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Bernd=20Ble=C3=9Fmann?= Date: Tue, 6 Apr 2021 12:47:05 +0200 Subject: [PATCH] =?utf8?q?Dateimanagement:=20gr=C3=B6=C3=9Fere=20Vorschaub?= =?utf8?q?ilder:=20Versionen=20ber=C3=BCcksichtigen?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- SL/Controller/File.pm | 10 ++++++++-- js/kivi.File.js | 4 +++- templates/webpages/file/list.html | 2 +- 3 files changed, 12 insertions(+), 4 deletions(-) diff --git a/SL/Controller/File.pm b/SL/Controller/File.pm index fdfded276..95030a4a8 100644 --- a/SL/Controller/File.pm +++ b/SL/Controller/File.pm @@ -317,10 +317,16 @@ sub action_download { sub action_ajax_get_thumbnail { my ($self) = @_; - my $file = SL::File->get(id => $::form->{file_id}); + my $id = $::form->{file_id}; + my $version = $::form->{file_version}; + my $file = SL::File->get(id => $id); + + $file->version($version) if $version; + my $thumbnail = _create_thumbnail($file, $::form->{size}); - my $overlay_selector = '#enlarged_thumb_' . $::form->{file_id}; + my $overlay_selector = '#enlarged_thumb_' . $id; + $overlay_selector .= '_' . $version if $version; $self->js ->attr($overlay_selector, 'src', 'data:' . $thumbnail->{thumbnail_img_content_type} . ';base64,' . MIME::Base64::encode_base64($thumbnail->{thumbnail_img_content})) ->data($overlay_selector, 'is-overlay-loaded', '1') diff --git a/js/kivi.File.js b/js/kivi.File.js index 8645a09c5..6b4ea462c 100644 --- a/js/kivi.File.js +++ b/js/kivi.File.js @@ -303,7 +303,9 @@ namespace('kivi.File', function(ns) { ns.add_enlarged_thumbnail = function(e) { var file_id = $(e.target).data('file-id'); + var file_version = $(e.target).data('file-version'); var overlay_img_id = 'enlarged_thumb_' + file_id; + if (file_version) { overlay_img_id = overlay_img_id + '_' + file_version }; var overlay_img = $('#' + overlay_img_id); if (overlay_img.data('is-overlay-shown') == 1) return; @@ -317,7 +319,7 @@ namespace('kivi.File', function(ns) { var data = { action: 'File/ajax_get_thumbnail', file_id: file_id, - file_version: $(e.target).data('file-version'), + file_version: file_version, size: 512 }; diff --git a/templates/webpages/file/list.html b/templates/webpages/file/list.html index fe90f4c37..24da21179 100644 --- a/templates/webpages/file/list.html +++ b/templates/webpages/file/list.html @@ -70,7 +70,7 @@ data-file-id="[% file.id %]" data-file-version="[% file.version %]" src="data:[% HTML.escape(file.thumbnail.thumbnail_img_content_type) %];base64,[% file.thumbnail.thumbnail_img_content.encode_base64 %]" alt="[% file.file_name %]"> - + [%- ELSE %] - -- 2.20.1