From cfff992eab53d611afdaca545898e3010f3806c0 Mon Sep 17 00:00:00 2001 From: Konstantin Sivakov Date: Sun, 28 Aug 2022 20:37:11 +0200 Subject: [PATCH] Use call macro for image_uload --- .../templates/scheming/form_snippets/upload.html | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/ckanext/scheming/templates/scheming/form_snippets/upload.html b/ckanext/scheming/templates/scheming/form_snippets/upload.html index d4798eaf..f57932cf 100644 --- a/ckanext/scheming/templates/scheming/form_snippets/upload.html +++ b/ckanext/scheming/templates/scheming/form_snippets/upload.html @@ -1,7 +1,8 @@ {% import 'macros/form.html' as form %} {%- set is_upload = (data.url_type == 'upload') -%} -{{ form.image_upload( + +{% call form.image_upload( data, errors, field_url=field.field_name, @@ -12,8 +13,10 @@ is_upload=is_upload, upload_label=h.scheming_language_text(field.upload_label), url_label=h.scheming_language_text(field.label), + classes=field.classes if 'classes' in field else ['control-medium'], + attrs=dict({"class": "form-control"}, **(field.get('form_attrs', {}))), placeholder=field.form_placeholder - ) -}} -{# image_upload macro doesn't support call #} -{%- snippet 'scheming/form_snippets/help_text.html', field=field -%} + ) +%} + {%- snippet 'scheming/form_snippets/help_text.html', field=field -%} +{% endcall %} \ No newline at end of file