From 11560e68081ecc0095a61f408ce1e88314ada07e Mon Sep 17 00:00:00 2001 From: =?utf8?q?Bernd=20Ble=C3=9Fmann?= Date: Mon, 31 May 2021 11:05:38 +0200 Subject: [PATCH] Dateimanagement: Vorschau auch anklickbar zum Download machen --- css/common.css | 4 ++++ js/kivi.File.js | 16 +++++++++++++++- templates/webpages/file/list.html | 3 ++- 3 files changed, 21 insertions(+), 2 deletions(-) diff --git a/css/common.css b/css/common.css index 69ebbfdbb..dd295006f 100644 --- a/css/common.css +++ b/css/common.css @@ -233,3 +233,7 @@ span.upload_drop_zone { z-index: 2; cursor: pointer; } + +.thumbnail { + cursor: pointer; +} diff --git a/js/kivi.File.js b/js/kivi.File.js index 6b4ea462c..eeca3258c 100644 --- a/js/kivi.File.js +++ b/js/kivi.File.js @@ -332,6 +332,20 @@ namespace('kivi.File', function(ns) { $('.thumbnail').on('mouseover', ns.add_enlarged_thumbnail); }; + ns.download = function(e) { + var file_id = $(e.target).data('file-id'); + var file_version = $(e.target).data('file-version'); + + var data = { + action: 'File/download', + id: file_id, + version: file_version, + }; + + $.post("controller.pl", data, kivi.eval_json_result); + + }; + ns.init = function() { // Preventing page from redirecting $("#" + ns.list_div_id).on("dragover", function(e) { @@ -373,8 +387,8 @@ namespace('kivi.File', function(ns) { }); $('.thumbnail').on('mouseover', ns.add_enlarged_thumbnail); - $('.overlay_img').on('click', ns.remove_enlarged_thumbnail); $('.overlay_img').on('mouseout', ns.remove_enlarged_thumbnail); + $('.overlay_div img').on('click', ns.download); }; }); diff --git a/templates/webpages/file/list.html b/templates/webpages/file/list.html index 039f4a242..315e886d2 100644 --- a/templates/webpages/file/list.html +++ b/templates/webpages/file/list.html @@ -70,7 +70,8 @@ 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