From 7d023283266e62ebe1e891f8c36b2e36d13fa5dd Mon Sep 17 00:00:00 2001 From: Maharshi Patel Date: Wed, 3 Apr 2024 11:34:38 +0530 Subject: [PATCH] fix: only render new line if value is present In dynamic content new line / `
` was rendering even if value was empty. which leaves empty line in the content. this commit fixes that for old_print_format jinja template. also, added missing jinja code for suffix in new template. --- .../print_designer/jinja/macros/spantag.html | 28 ++++++++----- .../jinja/old_print_format.html | 40 ++++++++++--------- 2 files changed, 39 insertions(+), 29 deletions(-) diff --git a/print_designer/print_designer/page/print_designer/jinja/macros/spantag.html b/print_designer/print_designer/page/print_designer/jinja/macros/spantag.html index 04297f5..68c91ff 100644 --- a/print_designer/print_designer/page/print_designer/jinja/macros/spantag.html +++ b/print_designer/print_designer/page/print_designer/jinja/macros/spantag.html @@ -24,18 +24,26 @@ {% macro span_tag(field, element, row = {}, send_to_jinja = {}) -%} {% set span_value = spanvalue(field, element, row, send_to_jinja) %} - - {% if not field.is_static and field.is_labelled and span_value %} - - {{ _(field.label) }} - - {% endif %} + {%- if span_value -%} + + {% if not field.is_static and field.is_labelled%} + + {{ _(field.label) }} + + {% endif %} {{ span_value }} - {% if field.nextLine %} -
- {% endif %} -
+ {% if field.suffix %} + + {{ _(field.suffix) }} + + {% endif %} + {% if field.nextLine %} +
+ {% endif %} +
+ {% endif %} {%- endmacro %} \ No newline at end of file diff --git a/print_designer/print_designer/page/print_designer/jinja/old_print_format.html b/print_designer/print_designer/page/print_designer/jinja/old_print_format.html index c1fb537..0a54666 100644 --- a/print_designer/print_designer/page/print_designer/jinja/old_print_format.html +++ b/print_designer/print_designer/page/print_designer/jinja/old_print_format.html @@ -140,26 +140,28 @@ {% macro render_spantag(field, element, row = {}, send_to_jinja = {}) -%} {% set span_value = render_spanvalue(field, element, row, send_to_jinja) %} - - {% if not field.is_static and field.is_labelled and span_value %} - - {{ _(field.label) }} - - {% endif %} - - {{ span_value }} - - {% if field.suffix and span_value %} - - {{ _(field.suffix) }} +{%- if span_value -%} + + {% if not field.is_static and field.is_labelled %} + + {{ _(field.label) }} + + {% endif %} + + {{ span_value }} + + {% if field.suffix %} + + {{ _(field.suffix) }} + + {% endif %} + {% if field.nextLine %} +
+ {% endif %}
- {% endif %} - {% if field.nextLine %} -
- {% endif %} -
+{% endif %} {%- endmacro %} {% macro render_element(element, send_to_jinja) -%} {% if element is iterable and (element is not string and element is not mapping) %}