nineskeletor/templates/File/upload.html.twig

75 lines
1.7 KiB
Twig
Raw Normal View History

2023-02-01 09:03:27 +01:00
{% extends 'base.html.twig' %}
{% block encoretags %}
{{ encore_entry_link_tags('dropzone') }}
{% endblock %}
{% block localstyle %}
<style>
body { height:auto;}
#page { padding: 0px !important;}
</style>
{% endblock %}
{% block body %}
<a class="btn btn-secondary" onClick="closeModal();">Annuler</a>
<form
action="{{ oneup_uploader_endpoint('file') }}"
class="dropzone"
id="mydropzone"
{% if type=="image" %}data-acceptedMimeTypes="image/*"{% endif %}
data-maxFiles="0"
style="margin-top:10px">
</form>
{% endblock %}
{% block localscript %}
{{ encore_entry_script_tags('dropzone') }}
<script>
function dropzoneinit( elmt ) {
var totalFiles = 0;
var completeFiles = 0;
elmt.on("sending", function(file, xhr, formData) {
formData.append("folder", "{{ folder }}");
});
elmt.on("addedfile", function (file) {
totalFiles += 1;
});
elmt.on("removed file", function (file) {
totalFiles -= 1;
});
elmt.on("complete", function (file) {
completeFiles += 1;
if (completeFiles === totalFiles) {
{% if forcereload %}
parent.location.reload();
{% else %}
parent.refreshPJ();
closeModal();
{% endif %}
}
});
}
function dropzonesuccess( file, response ) {
//closeModal();
}
function closeModal() {
window.parent.$("#mymodallarge").modal('hide');
window.parent.$("#mymodalfull").modal('hide');
}
</script>
{% endblock %}