From f9ec0e4f3dd56dd6e8ac81114f61105cf5bce82e Mon Sep 17 00:00:00 2001 From: "lubomira.trnavska" Date: Sat, 16 Nov 2024 15:33:24 +0100 Subject: [PATCH] Add filecount to FS list --- app/javascript/controllers/dropzone_controller.js | 4 ++++ app/views/fs/message_drafts/_new_form.html.erb | 4 +++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/app/javascript/controllers/dropzone_controller.js b/app/javascript/controllers/dropzone_controller.js index 3c7667c8..86408d9c 100644 --- a/app/javascript/controllers/dropzone_controller.js +++ b/app/javascript/controllers/dropzone_controller.js @@ -5,6 +5,7 @@ export default class extends Controller { const dropzone = document.getElementById('dropzone'); const fileInput = document.getElementById('content[]'); const fileList = document.getElementById('fileList'); + const fileCount = document.getElementById('fileCount'); dropzone.addEventListener('dragover', (e) => { e.preventDefault(); @@ -38,6 +39,9 @@ export default class extends Controller { listItem.textContent = `${file.name} (${this.formatBytes(file.size)})`; fileList.appendChild(listItem); } + + fileCount.parentElement.classList.remove('hidden'); + fileCount.textContent = `${parseInt(fileCount.textContent) + files.length}`; } formatBytes(bytes) { diff --git a/app/views/fs/message_drafts/_new_form.html.erb b/app/views/fs/message_drafts/_new_form.html.erb index d9ac0cdb..25df931b 100644 --- a/app/views/fs/message_drafts/_new_form.html.erb +++ b/app/views/fs/message_drafts/_new_form.html.erb @@ -16,7 +16,9 @@

alebo ich sem presuňte

-
+
+ +
<% end %>