diff --git a/InvenTree/part/templates/part/part_base.html b/InvenTree/part/templates/part/part_base.html index 5dc7add027..c1836b9f8f 100644 --- a/InvenTree/part/templates/part/part_base.html +++ b/InvenTree/part/templates/part/part_base.html @@ -13,12 +13,17 @@
- +
+
+ +
+ {% csrf_token %} +

diff --git a/InvenTree/static/css/inventree.css b/InvenTree/static/css/inventree.css index 3a9c1be184..78483daac5 100644 --- a/InvenTree/static/css/inventree.css +++ b/InvenTree/static/css/inventree.css @@ -10,6 +10,25 @@ color: #ffcc00; } +/* dropzone class - for Drag-n-Drop file uploads */ +.dropzone { + border: 1px solid #555; + z-index: 2; +} + +.dropzone * { + pointer-events: none; +} + +.dragover { + background-color: #55A; + border: 1px dashed #111; + opacity: 0.1; + -moz-opacity: 10%; + -webkit-opacity: 10%; +} + + .btn-glyph { padding-left: 6px; padding-right: 6px; @@ -28,7 +47,6 @@ .part-thumb { width: 150px; height: 150px; - border: 1px black solid; margin: 5px; padding: 5px; object-fit: contain; @@ -62,7 +80,7 @@ margin-right: 50px; margin-left: 50px; width: 100%; - //transition: 0.1s; + transition: 0.1s; } .body { @@ -181,4 +199,5 @@ @keyframes spin { from { transform: scale(1) rotate(0deg);} to { transform: scale(1) rotate(360deg);} -} \ No newline at end of file +} + diff --git a/InvenTree/static/script/inventree/inventree.js b/InvenTree/static/script/inventree/inventree.js new file mode 100644 index 0000000000..e47e8f218b --- /dev/null +++ b/InvenTree/static/script/inventree/inventree.js @@ -0,0 +1,16 @@ +function inventreeDocReady() { + /* Run this function when the HTML document is loaded. + * This will be called for every page that extends "base.html" + */ + + /* Add drag-n-drop functionality to any element + * marked with the class 'dropzone' + */ + $('.dropzone').on('dragenter', function() { + $(this).addClass('dragover'); + }); + + $('.dropzone').on('dragleave', function() { + $(this).removeClass('dragover'); + }); +} \ No newline at end of file diff --git a/InvenTree/templates/base.html b/InvenTree/templates/base.html index 8331476cfa..21b1779924 100644 --- a/InvenTree/templates/base.html +++ b/InvenTree/templates/base.html @@ -65,6 +65,8 @@ InvenTree + + @@ -76,6 +78,15 @@ InvenTree $(document).ready(function () { {% block js_ready %} {% endblock %} + + /* Run document-ready scripts. + * Ref: static/script/inventree/inventree.js + */ + inventreeDocReady(); + + /* Display any cached alert messages + * Ref: static/script/inventree/notification.js + */ showCachedAlerts(); $('#launch-about').click(function() {