forms: run file widget js code from widget template (#52046)

This commit is contained in:
Frédéric Péters 2021-03-15 14:29:08 +01:00
parent 0554111893
commit 4e205acbe1
2 changed files with 6 additions and 5 deletions

View File

@ -361,9 +361,4 @@ $.WcsFileUpload = {
$(base_widget).parents('form').find('div.buttons button').prop('disabled', true);
var jqXHR = data.submit();
}
}
$(function() {
$('.file-upload-widget').each($.WcsFileUpload.prepare);
});

View File

@ -37,4 +37,10 @@
data-popup>{% trans "Use file from the portfolio" %}</span></p>
{% endif %}
{% endblock %}
<script>
$(function() {
$('[data-field-id="{{ widget.field.id }}"]').each($.WcsFileUpload.prepare);
});
</script>
{% endblock %}