{% macro render_field_with_errors(field) %} {% set label_text = field.label.text + ' *' if field.flags.required else field.label.text %}
{{ field.label(text=label_text, class="col-sm-2 col-form-label") }}
{% set field_class = kwargs['class'] if 'class' in kwargs else '' %} {% set field_class = field_class + ' form-control' %} {% if field.errors %} {% set field_class = field_class + ' is-invalid' %} {% endif %} {{ field(class=field_class, **kwargs)|safe }} {% if 'ri' in kwargs %} {% if kwargs['ri'] == 'rrule' %} {% endif %} {% endif %} {% if field.errors %}
{% for error in field.errors %}
{{ error }}
{% endfor %}
{% endif %}
{% endmacro %} {% macro render_field(field) %}

{{ field(class="btn btn-primary", **kwargs)|safe }}

{% endmacro %} {% macro render_field_errors(field) %}

{% if field and field.errors %}

{% endif %}

{% endmacro %} {% macro render_ooa(ooa) %} {% if ooa.admin_unit %} {{ ooa.admin_unit.name }} {% endif %} {% if ooa.organization %} {{ ooa.organization.name }} {% endif %} {% endmacro %} {% macro render_ooa_with_link(ooa) %} {% if ooa.admin_unit %} {{ ooa.admin_unit.name }} {% endif %} {% if ooa.organization %} {{ ooa.organization.name }} {% endif %} {% endmacro %} {% macro render_location(location) %} {%- if location.street -%} {{ location.street }}, {{ location.postalCode }} {{ location.city }} {%- else -%} {{ location.postalCode }} {{ location.city }} {%- endif -%} {% endmacro %} {% macro render_place(place) %} {%- if place.location -%} {{ place.name }}, {{render_location(place.location)}} {%- else -%} {{ place.name }} {%- endif -%} {% endmacro %} {% macro render_events_sub_menu(user_can_create_event, user_can_list_event_suggestion) %}
{% if user_can_create_event %} {{ _('Create event') }} {% endif %} {{ _('Suggest event') }}
{% if user_can_list_event_suggestion %}
{{ _('Event suggestions') }}
{% endif %} {% endmacro %} {% macro render_events(events) %}
{% for event in events %} {% endfor %}
{{ _('Date') }} {{ _('Name') }} {{ _('Host') }} {{ _('Location') }}
{{ render_event_date(event) }} {{ event.name }} {% if event.verified %} {% endif %} {{ render_ooa(event.host) }} {{ render_place(event.place) }}
{{ _('Show all events') }}
{% endmacro %} {% macro render_location_card(location, place=None) %} {% if location %}

{{ location.street }}
{{ location.postalCode }} {{ location.city }}

{{ _('Show on Google Maps') }}

{% endif %} {% endmacro %} {% macro render_string_prop(prop, icon = None, label_key = None) %} {% if prop %}
{% if icon %}{% endif %} {{ prop }}
{% endif %} {% endmacro %} {% macro render_bool_prop(prop, icon, label_key) %} {% if prop %}
{{ _(label_key) }}
{% endif %} {% endmacro %} {% macro render_enum_prop(prop, icon, label_key) %} {% if prop and prop.value > 1 %}
{{ prop | loc_enum }}
{% endif %} {% endmacro %} {% macro render_range_prop(from, to, icon, label_key) %} {% if from or to %}
{{ from }} - {{ to }}
{% endif %} {% endmacro %} {% macro render_tag_prop(tags) %} {% if tags %}
{{ tags }}
{% endif %} {% endmacro %} {% macro render_link_prop(link) %} {% if link %}
{{ link }}
{% endif %} {% endmacro %} {% macro render_email_prop(email) %} {% if email %}
{{ email }}
{% endif %} {% endmacro %} {% macro render_phone_prop(phone) %} {% if phone %}
{{ phone }}
{% endif %} {% endmacro %} {% macro render_location_prop(location) %} {% if location %}
{{ render_location(location) }}
{% endif %} {% endmacro %} {% macro render_image(image_id) %} {% if image_id %} {% endif %} {% endmacro %} {% macro render_logo(image_id) %} {% if image_id %} {% endif %} {% endmacro %} {% macro render_event_props(event, start, end, dates = None) %}
{{ _('Event') }}
{{ event.name }}
{% if dates and dates|length > 1 %}
{{ start | timeformat('short') }} {% if end %}- {{ end | timeformat('short') }}{% endif %} | {{ _('%(count)d event dates', count=dates|length) }}
{% else %}
{{ start | datetimeformat('short') }} {% if end %}- {{ end | datetimeformat('short') }}{% endif %}
{% endif %} {{ render_enum_prop(event.status, 'fa-info-circle', 'Status') }} {% if event.previous_start_date %}
{{ event.previous_start_date | datetimeformat('short') }}
{% endif %} {% if event.verified %}
{{ _('Verified') }}
{% endif %} {% if event.photo_id %}
{{ render_image(event.photo_id) }}
{% endif %}
{{ event.description }}
{{ render_link_prop(event.external_link) }} {{ render_link_prop(event.ticket_link) }} {% if event.category_id %}
{{ event.category | event_category_name }}
{% endif %} {{ render_tag_prop(event.tags) }} {{ render_bool_prop(event.kid_friendly, 'fa-child', 'Kid friendly') }} {{ render_bool_prop(event.accessible_for_free, 'fa-door-open', 'Accessible for free') }} {{ render_range_prop(event.age_from, event.age_to, 'fa-people-arrows', 'Typical Age range') }} {{ render_enum_prop(event.target_group_origin, 'fa-users', 'Target group origin') }} {{ render_enum_prop(event.attendance_mode, 'fa-mouse-pointer', 'Attendance mode') }}
{{ _('Place') }}
{{ event.place.name }}
{% if event.place.photo_id %}
{{ render_image(event.place.photo_id) }}
{% endif %} {% if event.place.description %}
{{ event.place.description }}
{% endif %}
{{ render_link_prop(event.place.url) }} {{ render_location_prop(event.place.location) }}

{{ _('Show directions') }}

{% if event.organizer %}
{{ _('Organizer') }}
{{ render_string_prop(event.organizer.name) }} {{ render_string_prop(event.organizer.org_name) }} {{ render_link_prop(event.organizer.url) }} {{ render_email_prop(event.organizer.email) }} {{ render_phone_prop(event.organizer.phone) }}
{% endif %} {% if event.host %}
{{ _('Host') }}
{% if event.host.admin_unit %}
{{ event.host.admin_unit.name }}
{% if event.host.admin_unit.logo_id %}
{{ render_logo(event.host.admin_unit.logo_id) }}
{% endif %}
{{ render_link_prop(event.host.admin_unit.url) }} {{ render_email_prop(event.host.admin_unit.email) }} {{ render_phone_prop(event.host.admin_unit.phone) }} {{ render_location_prop(event.host.admin_unit.location) }}
{% endif %} {% if event.host.organization %}
{{ event.host.organization.name }}
{% if event.host.organization.logo_id %}
{{ render_logo(event.host.organization.logo_id) }}
{% endif %}
{{ render_link_prop(event.host.organization.url) }} {{ render_email_prop(event.host.organization.email) }} {{ render_phone_prop(event.host.organization.phone) }} {{ render_location_prop(event.host.organization.location) }}
{% endif %}
{% endif %} {% endmacro %} {% macro render_google_sign_in_button() %} {{ _('Sign in with Google') }} {% endmacro %} {% macro render_google_place_autocomplete_header(location_only = False) %} {% endmacro %} {% macro render_google_place_autocomplete_field() %}
{% endmacro %} {% macro render_event_date(event) %} {{ event.start | datetimeformat('short') }} {% if event.recurrence_rule %} {% endif %} {% endmacro %}