nineskeletor/templates/Pagewidgetslide/upload.html.twig

44 lines
1.1 KiB
Twig
Executable File

{% extends 'base.html.twig' %}
{% block encoretags %}
{{ encore_entry_link_tags('dropzone') }}
{% endblock %}
{% block body %}
<a class="btn btn-secondary" onClick="closeModal();">Annuler</a>
<form
action="{{ oneup_uploader_endpoint('slide') }}"
class="dropzone"
id="mydropzone"
data-acceptedMimeTypes="image/*"
data-maxFiles=1
data-folder={{ pagewidget.id }}
style="margin-top:10px">
</form>
{% endblock %}
{% block localscript %}
{{ encore_entry_script_tags('dropzone') }}
<script>
function dropzoneinit( elmt ) {
elmt.on("sending", function(file, xhr, formData) {
formData.append("folder", "{{ pagewidget.id }}");
});
}
function dropzonesuccess( file, response ) {
parent.$("#pagewidgetslide_image").val("slide/{{pagewidget.id}}/"+response["file"]);
parent.$("#pagewidgetslide_image_img").attr("src","{{ path("app_minio_image",{file:"slide/"~pagewidget.id~"/"}) }}"+response["file"]);
closeModal();
}
function closeModal() {
window.parent.$("#mymodallarge").modal('hide');
}
</script>
{% endblock %}