Drag-and-drop attachments for stock item

This commit is contained in:
Oliver Walters 2020-05-13 11:22:57 +10:00
parent db01f3646a
commit 7143c32fc9
2 changed files with 16 additions and 0 deletions

View File

@ -346,9 +346,11 @@
z-index: 2; z-index: 2;
} }
/*
.dropzone * { .dropzone * {
pointer-events: none; pointer-events: none;
} }
*/
.dragover { .dragover {
background-color: #55A; background-color: #55A;

View File

@ -17,6 +17,20 @@
{% block js_ready %} {% block js_ready %}
{{ block.super }} {{ 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() { $("#new-attachment").click(function() {
launchModalForm("{% url 'stock-item-attachment-create' %}?item={{ item.id }}", launchModalForm("{% url 'stock-item-attachment-create' %}?item={{ item.id }}",
{ {