Skip to content
Snippets Groups Projects
Verified Commit 2b006b9e authored by Frank Sauerburger's avatar Frank Sauerburger
Browse files

Make form also clickable

parent ba48b485
Branches 2-handle-printer-select-field
No related tags found
No related merge requests found
......@@ -3,24 +3,13 @@ $(function() {
$("#dropzone").on("dragover", highlight);
$("#dropzone").on("dragleave", unhighlight);
$("#dropzone").on("drop", handleDrop);
/*
;['dragenter', 'dragover'].forEach(eventName => {
dropArea.addEventListener(eventName, highlight, false)
})
;['dragleave', 'drop'].forEach(eventName => {
dropArea.addEventListener(eventName, unhighlight, false)
})
function highlight(e) {
dropArea.classList.add('highlight')
}
function unhighlight(e) {
dropArea.classList.remove('highlight')
}
*/
$("#dropzone input[type=file]").on("click", function(e) {
e.stopPropagation();
});
$("#dropzone input[type=file]").on("change", handleSelect);
$("#dropzone").on("click", function() {
$("#dropzone input[type=file]").trigger('click');
});
});
function highlight(e) {
......@@ -41,6 +30,11 @@ function handleDrop(e) {
([...e.originalEvent.dataTransfer.files]).forEach(uploadFile);
}
function handleSelect(e) {
$("#dropzone").addClass("drop-uploading");
([...e.currentTarget.files]).forEach(uploadFile);
}
function uploadFile(file) {
$("#dropzone").addClass("drop-uploading");
let formData = new FormData();
......
......@@ -24,6 +24,7 @@
Cannot find any printer!
</div>
{% else %}
<div id="messages"></div>
<div class="form-group row">
<label class="col-form-label col-md-2" htmlFor="printer">Printer</label>
<select id="printer" class="form-control col-md-10">
......@@ -37,7 +38,6 @@
<input type="file" id="document" class="d-none" />
</div>
{% endif %}
<div id="messages"></div>
</main>
</body>
</html>
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment