aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorsilverwind <me@silverwind.io>2019-07-12 22:49:04 +0200
committerzeripath <art27@cantab.net>2019-07-12 21:49:04 +0100
commit831288cc916d5301beaa0adc1d912d6748a4cdaa (patch)
treecd99853868f8075f864944e109eb3333895769df
parenta23e19226a14b36fc25e8b392f08e19c46d9d8b6 (diff)
downloadgitea-831288cc916d5301beaa0adc1d912d6748a4cdaa.tar.gz
gitea-831288cc916d5301beaa0adc1d912d6748a4cdaa.zip
fix Dropzone.js integration (#7445)
-rw-r--r--public/js/index.js13
1 files changed, 7 insertions, 6 deletions
diff --git a/public/js/index.js b/public/js/index.js
index d890784abb..b5ead5e606 100644
--- a/public/js/index.js
+++ b/public/js/index.js
@@ -10,6 +10,9 @@ function htmlEncode(text) {
var csrf;
var suburl;
+// Disable Dropzone auto-discover because it's manually initialized
+Dropzone.autoDiscover = false;
+
// Polyfill for IE9+ support (https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/from)
if (!Array.from) {
Array.from = (function () {
@@ -2005,13 +2008,11 @@ $(document).ready(function () {
}
// Dropzone
- var $dropzone = $('#dropzone');
+ const $dropzone = $('#dropzone');
if ($dropzone.length > 0) {
- // Disable auto discover for all elements:
- Dropzone.autoDiscover = false;
+ const filenameDict = {};
- var filenameDict = {};
- $dropzone.dropzone({
+ new Dropzone("#dropzone", {
url: $dropzone.data('upload-url'),
headers: {"X-Csrf-Token": csrf},
maxFiles: $dropzone.data('max-file'),
@@ -2039,7 +2040,7 @@ $(document).ready(function () {
});
}
})
- }
+ },
});
}