From 7f84e36fb2f6a380635bc773eae32aa42203422c Mon Sep 17 00:00:00 2001 From: Laria Carolin Chabowski Date: Sat, 15 Feb 2020 23:48:26 +0100 Subject: Improve attachments - Allow multiple uploads at once - Make uploads deletable --- assets/interactive.js | 19 +++++++++++++++++-- assets/styles.css | 5 +++++ 2 files changed, 22 insertions(+), 2 deletions(-) (limited to 'assets') diff --git a/assets/interactive.js b/assets/interactive.js index 05b7556..404cc26 100644 --- a/assets/interactive.js +++ b/assets/interactive.js @@ -102,7 +102,7 @@ $(function () { this.set_visible(false); return; } - + this.get_suggestions(input_text, function (suggestions) { console.log(suggestions); suggestions = Array.prototype.slice.call(suggestions, 0); @@ -289,5 +289,20 @@ $(function () { $("button.confirm").on("click", function (ev) { if (!window.confirm($(this).data("question"))) ev.preventDefault(); - }) + }); + + function updateAttachmentDeletionClass(tr) { + tr = $(tr); + tr.toggleClass("delete", tr.find(".attachment-delete-checkbox")[0].checked); + } + + function attachmentDeleteCheckbox(tr) { + $(tr).each(function () { + updateAttachmentDeletionClass(this); + }).find(".attachment-delete-checkbox").on("change", function () { + updateAttachmentDeletionClass($(this).closest("tr")); + }); + } + + attachmentDeleteCheckbox($(".attachments tbody tr")); }); \ No newline at end of file diff --git a/assets/styles.css b/assets/styles.css index b9fca4d..3008b4e 100644 --- a/assets/styles.css +++ b/assets/styles.css @@ -229,4 +229,9 @@ input:placeholder-shown { .autocomplete-root:not(.show-suggestions) ul { display: none; +} + +.attachments .delete { + font-style: italic; + text-decoration: line-through; } \ No newline at end of file -- cgit v1.2.3-70-g09d2