{% macro _render_badge_form_button(regform, tpl, format='text', text='') %} {% set no_registrations = not regform.registrations|rejectattr('is_deleted')|list %} {% set no_registrations_msg %} {% trans %}Registration Form has no registrations{% endtrans %} {% endset %} {% set print_title -%} {%- if tpl.is_ticket -%} {% trans %}Print tickets{% endtrans %} {%- else -%} {% trans %}Print badges{% endtrans %} {%- endif -%} {%- endset %} {% set endpoint = 'registrations_config_tickets' if tpl.is_ticket else 'registrations_config_badges' %} {% if format == 'icon' %} {% else %} {% if no_registrations %} {{ text }} {% else %} {{ text }} {% endif %} {% endif %} {% endmacro %} {% macro _render_template(tpl, target, inherited=false, event=none, default_ticket=none, default_badge=none, not_deletable_templates=[]) -%} {{ tpl.title }} {% if inherited %} {% if not tpl.category.is_root %} {% trans title=tpl.category.title -%} from category "{{ title }}" {% endtrans %} {% endif %} {% endif %}
{% if not event and tpl.type.name == 'badge' and tpl.is_ticket %} {% set inherited_default = default_ticket == tpl and tpl.category != target and not target.default_ticket_template %} {% set global_default = default_ticket == tpl and target.is_root %} {% endif %} {% if not event and tpl.type.name == 'badge' and not tpl.is_ticket %} {% set inherited_default = default_badge == tpl and tpl.category != target and not target.default_badge_template %} {% set global_default = default_badge == tpl and target.is_root %} {% endif %} {% set clonable = tpl.is_clonable or (not event and tpl.owner == target) %} {% if not inherited %} {% endif %} {% if not inherited %} {%- endif %}
{% if tpl.type.name == 'poster' and event %} {% elif event %} {% set single_form = event.registration_forms|first if event.registration_forms|length == 1 %} {% if single_form %} {{ _render_badge_form_button(single_form, tpl, format='icon') }} {% else %} {% set print_title -%} {%- if tpl.is_ticket -%} {% trans %}Print tickets{% endtrans %} {%- else -%} {% trans %}Print badges{% endtrans %} {%- endif -%} {%- endset %} {% endif %} {% endif %}
{% endmacro -%} {% macro render_template_list(templates, target, inherited_templates=[], event=none, default_ticket=none, default_badge=none, not_deletable_templates=[]) -%} {% if inherited_templates %}

{% trans %}Inherited templates{% endtrans %}

{% for tpl in inherited_templates | sort(attribute='title') | sort(attribute='type') %} {{ _render_template(tpl, target, inherited=true, event=event, default_ticket=default_ticket, default_badge=default_badge, not_deletable_templates=not_deletable_templates) }} {% endfor %}
{% endif %}

{% trans %}Custom templates{% endtrans %}

{% if templates %} {% for tpl in templates | sort(attribute='title') | sort(attribute='type') %} {{ _render_template(tpl, target, event=event, default_ticket=default_ticket, default_badge=default_badge, not_deletable_templates=not_deletable_templates) }} {% endfor %}
{% else %}
{% trans %}No templates{% endtrans %}
{% endif %}
{% endmacro -%}