From 7143c32fc95b6521dc92f41c3682424f56023fb1 Mon Sep 17 00:00:00 2001 From: Oliver Walters Date: Wed, 13 May 2020 11:22:57 +1000 Subject: [PATCH] Drag-and-drop attachments for stock item --- InvenTree/InvenTree/static/css/inventree.css | 2 ++ .../stock/templates/stock/item_attachments.html | 14 ++++++++++++++ 2 files changed, 16 insertions(+) diff --git a/InvenTree/InvenTree/static/css/inventree.css b/InvenTree/InvenTree/static/css/inventree.css index a1358341cc..7861be295a 100644 --- a/InvenTree/InvenTree/static/css/inventree.css +++ b/InvenTree/InvenTree/static/css/inventree.css @@ -346,9 +346,11 @@ z-index: 2; } +/* .dropzone * { pointer-events: none; } +*/ .dragover { background-color: #55A; diff --git a/InvenTree/stock/templates/stock/item_attachments.html b/InvenTree/stock/templates/stock/item_attachments.html index 2d056afbcf..453ab7f09b 100644 --- a/InvenTree/stock/templates/stock/item_attachments.html +++ b/InvenTree/stock/templates/stock/item_attachments.html @@ -17,6 +17,20 @@ {% block js_ready %} {{ block.super }} +enableDragAndDrop( + '#attachment-dropzone', + "{% url 'stock-item-attachment-create' %}", + { + data: { + stock_item: {{ item.id }}, + }, + label: 'attachment', + success: function(data, status, xhr) { + location.reload(); + } + } + ); + $("#new-attachment").click(function() { launchModalForm("{% url 'stock-item-attachment-create' %}?item={{ item.id }}", {