From: Bernd Bleßmann Date: Mon, 31 May 2021 09:05:38 +0000 (+0200) Subject: Dateimanagement: Vorschau auch anklickbar zum Download machen X-Git-Tag: kivitendo-mebil_0.1-0~9^2~198 X-Git-Url: http://wagnertech.de/git?a=commitdiff_plain;h=11560e68081ecc0095a61f408ce1e88314ada07e;p=kivitendo-erp.git Dateimanagement: Vorschau auch anklickbar zum Download machen --- 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 %] -