mirror of
https://github.com/inventree/InvenTree.git
synced 2025-04-29 20:16:44 +00:00
inventree.js
This commit is contained in:
parent
90a75ac7cb
commit
00f012311d
@ -1,5 +1,20 @@
|
|||||||
{% load inventree_extras %}
|
{% load inventree_extras %}
|
||||||
|
|
||||||
|
/* globals
|
||||||
|
ClipboardJS,
|
||||||
|
inventreeFormDataUpload,
|
||||||
|
launchModalForm,
|
||||||
|
user_settings,
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* exported
|
||||||
|
attachClipboard,
|
||||||
|
enableDragAndDrop,
|
||||||
|
inventreeDocReady,
|
||||||
|
inventreeLoad,
|
||||||
|
inventreeSave,
|
||||||
|
*/
|
||||||
|
|
||||||
function attachClipboard(selector, containerselector, textElement) {
|
function attachClipboard(selector, containerselector, textElement) {
|
||||||
// set container
|
// set container
|
||||||
if (containerselector){
|
if (containerselector){
|
||||||
@ -8,6 +23,8 @@ function attachClipboard(selector, containerselector, textElement) {
|
|||||||
containerselector = document.body;
|
containerselector = document.body;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var text = null;
|
||||||
|
|
||||||
// set text-function
|
// set text-function
|
||||||
if (textElement){
|
if (textElement){
|
||||||
text = function() {
|
text = function() {
|
||||||
@ -21,6 +38,7 @@ function attachClipboard(selector, containerselector, textElement) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// create Clipboard
|
// create Clipboard
|
||||||
|
// eslint-disable-next-line no-unused-vars
|
||||||
var cis = new ClipboardJS(selector, {
|
var cis = new ClipboardJS(selector, {
|
||||||
text: text,
|
text: text,
|
||||||
container: containerselector
|
container: containerselector
|
||||||
@ -51,12 +69,13 @@ function inventreeDocReady() {
|
|||||||
// TODO - Only indicate that a drop event will occur if a file is being dragged
|
// TODO - Only indicate that a drop event will occur if a file is being dragged
|
||||||
var transfer = event.originalEvent.dataTransfer;
|
var transfer = event.originalEvent.dataTransfer;
|
||||||
|
|
||||||
|
// eslint-disable-next-line no-constant-condition
|
||||||
if (true || isFileTransfer(transfer)) {
|
if (true || isFileTransfer(transfer)) {
|
||||||
$(this).addClass('dragover');
|
$(this).addClass('dragover');
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
$('.dropzone').on('dragleave drop', function(event) {
|
$('.dropzone').on('dragleave drop', function() {
|
||||||
$(this).removeClass('dragover');
|
$(this).removeClass('dragover');
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -154,7 +173,7 @@ function enableDragAndDrop(element, url, options) {
|
|||||||
method - HTTP method
|
method - HTTP method
|
||||||
*/
|
*/
|
||||||
|
|
||||||
data = options.data || {};
|
var data = options.data || {};
|
||||||
|
|
||||||
$(element).on('drop', function(event) {
|
$(element).on('drop', function(event) {
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user