From 1f53ee759791206613c6fb8b507fff30836e3614 Mon Sep 17 00:00:00 2001
From: Eugen Neuber <eugen.neuber@tugraz.at>
Date: Wed, 24 Mar 2021 15:14:32 +0100
Subject: [PATCH] Add marking of downloaded files

See issue #38
---
 src/dbp-official-signature-pdf-upload.js | 4 ++--
 src/dbp-signature-lit-element.js         | 5 ++++-
 2 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/src/dbp-official-signature-pdf-upload.js b/src/dbp-official-signature-pdf-upload.js
index 811bcba..93eca0f 100644
--- a/src/dbp-official-signature-pdf-upload.js
+++ b/src/dbp-official-signature-pdf-upload.js
@@ -769,12 +769,12 @@ class OfficialSignaturePdfUpload extends ScopedElementsMixin(DBPSignatureLitElem
             const file = this.signedFiles[id];
 
             results.push(html`
-                <div class="file-block">
+                <div class="file-block" id="file-block-${id}">
                     <div class="header">
                         <span class="filename"><strong>${file.name}</strong> (${humanFileSize(file.contentSize)})</span>
                         <button class="button close"
                             title="${i18n.t('official-pdf-upload.download-file-button-title')}"
-                            @click="${() => { this.downloadFileClickHandler(file); }}">
+                            @click="${() => { this.downloadFileClickHandler(file, 'file-block-' + id); }}">
                             <dbp-icon name="download"></dbp-icon></button>
                     </div>
                 </div>
diff --git a/src/dbp-signature-lit-element.js b/src/dbp-signature-lit-element.js
index bdcd73d..a2ea686 100644
--- a/src/dbp-signature-lit-element.js
+++ b/src/dbp-signature-lit-element.js
@@ -401,13 +401,16 @@ export default class DBPSignatureLitElement extends BaseLitElement {
      * Open Filesink for a single File
      *
      * @param file
+     * @param id of element to mark
      */
-    async downloadFileClickHandler(file) {
+    async downloadFileClickHandler(file, id) {
         let files = [];
         const arr = utils.convertDataURIToBinary(file.contentUrl);
         const binaryFile = new File([arr], file.name, { type: utils.getDataURIContentType(file.contentUrl) });
         files.push(binaryFile);
         this.signedFilesToDownload = files.length;
         this._("#file-sink").files = files;
+        const div = this.shadowRoot.querySelector('#' + id);
+        div.style.background='#c8dcc8';
     }
 }
-- 
GitLab