From a5f26def08e100bf74e90d09298ad81e9224e249 Mon Sep 17 00:00:00 2001 From: Marvin Borner Date: Sun, 21 Apr 2019 18:34:48 +0200 Subject: Added download button Co-authored-by: LarsVomMars --- src/main/resources/css/files.css | 32 ++++++++++++++++++++------ src/main/resources/js/files.js | 17 +++++++++++++- src/main/resources/views/files.rocker.html | 37 +++++++++++++++++++++++++----- 3 files changed, 72 insertions(+), 14 deletions(-) (limited to 'src/main/resources') diff --git a/src/main/resources/css/files.css b/src/main/resources/css/files.css index 5af9ec8..d0be48e 100644 --- a/src/main/resources/css/files.css +++ b/src/main/resources/css/files.css @@ -46,7 +46,7 @@ colgroup col:nth-child(1) { } colgroup col:nth-child(2) { - width: 35%; + width: 25%; } colgroup col:nth-child(3) { @@ -65,13 +65,17 @@ colgroup col:nth-child(6) { width: 10%; } +colgroup col:nth-child(7) { + width: 10%; +} + .drop { padding: 8px; min-height: calc(100vh - 16px); z-index: -1; } -.delete { +.share { font-size: 20px; background-color: inherit; border: 0; @@ -79,20 +83,34 @@ colgroup col:nth-child(6) { cursor: pointer; } -.delete:hover { +.share:hover { transform: scale(1.3); - color: red; + color: dodgerblue; } -.share { +.download, .downloadButton { font-size: 20px; + color: inherit; background-color: inherit; border: 0; z-index: 100; cursor: pointer; } -.share:hover { +.downloadButton:hover { transform: scale(1.3); - color: dodgerblue; + color: green; +} + +.delete { + font-size: 20px; + background-color: inherit; + border: 0; + z-index: 100; + cursor: pointer; +} + +.delete:hover { + transform: scale(1.3); + color: red; } diff --git a/src/main/resources/js/files.js b/src/main/resources/js/files.js index 4ef5bcc..c3fa1b1 100644 --- a/src/main/resources/js/files.js +++ b/src/main/resources/js/files.js @@ -35,7 +35,8 @@ drop.addEventListener('drop', e => { row.insertCell(2).innerHTML = bytesToSize(file.size); row.insertCell(3).innerHTML = `${date.getMonth() + 1}/${date.getDate()}/${date.getFullYear()} ${date.getHours()}:${date.getMinutes()}:${date.getSeconds()}`; row.insertCell(4).innerHTML = ""; - row.insertCell(5).innerHTML = ""; + row.insertCell(5).innerHTML = ""; + row.insertCell(6).innerHTML = ""; setListeners(); @@ -180,6 +181,20 @@ function setListeners() { }) }); + // download button + document.querySelectorAll(".download").forEach(element => { + element.addEventListener("click", e => { + e.stopPropagation(); + }) + }); + document.querySelectorAll(".downloadButton").forEach(element => { + element.addEventListener("click", e => { + console.log(e); + e.stopPropagation(); + e.target.children[0].click() + }) + }); + // share button document.querySelectorAll(".share").forEach(element => { element.addEventListener("click", e => { diff --git a/src/main/resources/views/files.rocker.html b/src/main/resources/views/files.rocker.html index f3f816a..56cfc88 100644 --- a/src/main/resources/views/files.rocker.html +++ b/src/main/resources/views/files.rocker.html @@ -31,6 +31,7 @@ + @@ -40,6 +41,7 @@ Size Last modified Share + Download Delete @@ -49,6 +51,7 @@ + @@ -62,19 +65,41 @@ @if (fileArray[4] == "true") { - + + + } else if (fileArray[3] == "false") { - + + + } else { - + + + } - @fileArray[0] - @fileArray[1] - @fileArray[2] + + @fileArray[0] + + + + @fileArray[1] + + + + @fileArray[2] + + + + + + + -- cgit v1.2.3