diff --git a/vasl_templates/webapp/data/default-template-pack/ob_vo.j2 b/vasl_templates/webapp/data/default-template-pack/ob_vo.j2 index da56b73..f7170b2 100644 --- a/vasl_templates/webapp/data/default-template-pack/ob_vo.j2 +++ b/vasl_templates/webapp/data/default-template-pack/ob_vo.j2 @@ -28,25 +28,33 @@ {% if vo.index == 0 %} + {% set PADDING_TOP = 2 %} {%else%} + {% set PADDING_TOP = 5 %} {%endif%} {% if vo.name_len <= MAX_VO_NAME_LEN %} {# NOTE: If the vehicle/ordnance name is short, put the capabilities to the right of it. #} - + {{INCLUDE:ob_vo.name}}
{{INCLUDE:ob_vo.image}} + {% set MAX_CAPABILITIES = 4 %} {%else%} {# NOTE: If the vehicle/ordnance name is long, put it on its own line, and the capabilities underneath. #} - + {{INCLUDE:ob_vo.name}} {{INCLUDE:ob_vo.image}} + {% set MAX_CAPABILITIES = 3 %} +{%endif%} + +{% if vo.small_piece %} + {% set MAX_CAPABILITIES = MAX_CAPABILITIES - 1 %} {%endif%} -{% if vo.capabilities_len >= 5 or !vo.image %} +{% if vo.capabilities_len > MAX_CAPABILITIES or !vo.image %} {# NOTE: If there are a lot of capabilities, tuck the note number & notes under the image. #} {# But if there is no image, we always do this, and squeeze them in to the left of the capabilities. #}
@@ -58,7 +66,7 @@ {%for cap in vo.capabilities%}
{{cap|nobr}}
{%endfor%} {%for cmnt in vo.comments%}
{{cmnt}}
{%endfor%} -{% if vo.capabilities_len < 5 and vo.image %} +{% if vo.capabilities_len <= MAX_CAPABILITIES and vo.image %} {# NOTE: If there are only a few capabilities, let the note number & notes spread full-width. #} {# But if there is no image, we never do this (see above). #} diff --git a/vasl_templates/webapp/static/snippets.js b/vasl_templates/webapp/static/snippets.js index 94900cd..0787651 100644 --- a/vasl_templates/webapp/static/snippets.js +++ b/vasl_templates/webapp/static/snippets.js @@ -749,6 +749,8 @@ function unload_snippet_params( unpack_scenario_date, template_id ) var url = get_vo_image_url( vo_entry, vo_image_id ) ; if ( url ) obj.image = APP_URL_BASE + url ; + if ( $(this).find( ".vo-entry" ).hasClass( "small-piece" ) ) + obj.small_piece = true ; } // NOTE: It would be nice to have a Jinja2 filter that inserted the raw capabilities or selected // the correct one for the scenario date e.g.