{% macro multi_input(_items, input_name) %} {% set items = _items or [None] %} {% for item in items %}
{% if loop.first %} {% else %} {% endif %}
{% endfor %} {% endmacro %} {% macro form_field_with_xpath(type, label, field_key, elem, delete_button=False) %}
{% if delete_button %} {% endif %}
{% endmacro %} {% macro classification_input(type, heading, elements, tooltip=None) %}
{% for item in elements or [None] %}
{{ form_field_with_xpath(type, 'ID', 'id', item.get('id') if item, delete_button=True) }} {{ form_field_with_xpath(type, 'URL', 'url', item.get('url') if item) }} {{ form_field_with_xpath(type, 'Value', 'value', item.get('value') if item) }}
{% endfor %} {% endmacro %} {% macro xpath_or_value_input(heading, input_name, item, collection_parser, required=False, tooltip=None) %}
{% endmacro %} {% macro image_xpath_input(heading, input_name, _items, collection_parser, required=False, tooltip=None) %}
{% set items = _items or [None] %} {% for item in items %}
{% set parent = (item.get('parent') or '') if item else '' %} {% set path = (item.get('path') or '') if item else '' %} {% set note = (item.get('note') or '') if item else '' %} {% set path_xpath = parent ~ path %} {% set note_xpath = parent ~ note %}
{% if loop.first %} {% else %} {% endif %}
{% endfor %}
{% endmacro %} {% macro required_fields_disclaimer() %}
* indicates required fields
{% endmacro %} {% macro section_heading(title, required=False, tooltip=None) %}
{% endmacro %} {% macro tab_container(name) %}
Loading...
{% endmacro %} {% macro next_tab_row(prev_tab=None, next_tab=None, prev_group=None, next_group=None) %}
{% if prev_tab %} {% if prev_group %} {% else %} {% endif %} {% else %}
{% endif %} {% if next_tab %} {% if next_group %} {% else %} {% endif %} {% endif %}
{% endmacro %} {% macro instance_switch (ul_id, btn_id_test, btn_id_live, btn_target_test, btn_target_live) -%}
{%- endmacro %} {% macro card_shell(title, file_count, icon_class, color, status_url=None, card_id=None) %}
{{ title }}
{{ file_count }} files
{{ caller() }}
{% endmacro %} {% macro content_card(title, modal_url, status_url, action, kind, collection=None, content_list=None) %} {# Unified status card for collection and other-files entries. kind: 'collection' -> renders the Validated column (file_errors from the validation results); 'other_files' -> only Uploaded/Published. collection -> bi-folder2/primary, other files -> bi-file-earmark/secondary. action: 'upload' | 'publish' -> drives footer texts and button label. status_url: status endpoint for this card; rendered as data-status-url (matches the modal's #statusURL poller key). data-card-id (kind:title:instance) is identical in the upload and publication tabs, so the status manager can refresh the card in both tabs. Requires `all_tgp_contents` and `instance` in the context (import with context). #} {% if kind == 'collection' %} {% set icon_class = 'bi-folder2' %} {% set color = 'primary' %} {% else %} {% set icon_class = 'bi-file-earmark' %} {% set color = 'secondary' %} {% endif %} {% if kind == 'collection' %} {% set rows = [] %} {% for file_name, file_errors in collection.files.items() %} {% set work_title = collection.file_attributes[file_name]['work_title'] if 'file_attributes' in collection else file_name %} {% do rows.append((work_title, file_name, work_title, file_errors)) %} {% endfor %} {% else %} {% set rows = [] %} {% for filename in content_list or [] %} {% do rows.append((filename, filename, filename, None)) %} {% endfor %} {% endif %} {% set keys = rows | map(attribute=2) | list %} {% set all_files_uploaded = keys|all_uploaded(all_tgp_contents) %} {% set all_files_published = keys|all_published(all_tgp_contents) %} {% set has_validation_errors = kind == 'collection' and collection.stats.error > 0 %} {% call card_shell(title=title, file_count=rows|length, icon_class=icon_class, color=color, status_url=status_url, card_id=kind ~ ':' ~ title ~ ':' ~ instance) %}
{% if rows|length > 0 %} {% if kind == 'collection' %} {% endif %} {% for name, file_label, key, file_errors in rows %} {% if kind == 'collection' %} {% endif %} {% endfor %}
File
{{ name }} {% if len(file_errors) == 0 %} {% else %} {% endif %} {% if all_tgp_contents[key] %} {% else %} {% endif %} {% if all_tgp_contents[key] and all_tgp_contents[key]['published'] %} {% else %} {% endif %}
{% else %}
No additional files configured
{% endif %}
{% endcall %} {% endmacro %}