Apply filters
{{openForm}}
{% set excludeDatasetFilters = this.setting('exclude_dataset_filters_picker') %}
{# Draw the top level filters. #}
{% for Level_1_filter_key, Level_1_filter in Level_1_filters %}
{% set location_dataset_filter_level_1 = this.setting('location_dataset_filter_level_1') %}
{% set location_dataset_filter_level_2 = this.setting('location_dataset_filter_level_2') %}
{% if ((not location_dataset_filter_level_1) or (location_dataset_filter_level_1 and location_dataset_filter_level_1 == Level_1_filter_key)) and Level_1_filter_key not in excludeDatasetFilters %}
{% if not Level_1_filter.hidden %}
{% endif %}
{# For each top level filter, draw the level 2 filters. #}
{# Level 2 filters are grouped by the top level filter ID. #}
{% if Level_2_filters and Level_2_filters[Level_1_filter_key] %}
{% for Level_2_filter_key, Level_2_filter in Level_2_filters[Level_1_filter_key] %}
{% if not location_dataset_filter_level_2 or location_dataset_filter_level_2 == Level_2_filter_key %}
{% set doNotRepeat = false %}
{% for field_id, field in Level_2_filter['values'] %}
{# For level 2 filters, first draw a checkbox to enable the filter. Then draw the filter input (text, select list, radios, checkboxes...) #}
{% if Level_2_filter_key not in excludeDatasetFilters %}
{% if not doNotRepeat %}
{% if field.type == "radio" or field.type == "select" %}
{# This is to prevent generating a checkbox for every radio/select option. #}
{# Also, if this element is a select list, the select tag is needed. #}
{% set doNotRepeat = true %}
{% if field.type == "select" and Level_2_filter.checked %}
{% endif %}
{% endif %}
{% endfor %}
{% endif %}
{% endif %}
{% endfor %}
{{closeForm}}
{% endif %}
{% if not Level_1_filters and not Level_2_filters %}
{{'No flags found.'|trans}}
{% endif %}
{% if Selected_filters %}
{% for Selected_filter in Selected_filters %}
{{Selected_filter.label}}
X
{% endfor %}
{% endif %}
{% endif %}
{% if this.setting('show_location_list') and this.setting('show_map') %}
List
Map
{% endif %}
{{list_title|e}}
{% if note_below %}
{{note_below|e}}
{% endif %}
{% for location in locations %}
{% if this.setting('show_images') and location.list_image %}
{% endif %}
{% if this.setting('locations__field__name') %}
{{location.name|escape}}
{% endif %}
{% if this.setting('locations__field__checkbox_selection') and location.filters_list %}
{# Show a list of filters assigned to the location. #}
{# Make sure the filter set as the icon is in bold. #}
{# Separate the filters with commas. #}
{# Only show checkbox-type fields. #}
{% for location_key, location_filter in location.filters_list %}
{% if location_key == location.icon_name %}{% endif %}{{location_filter.label|e}}{% if location_key == location.icon_name %}{% endif %}{% if not loop.last %},{% endif %}
{% endfor %}
{% endif %}
{% if this.setting('locations__field__address') %}
{% set addressline = [] %}
{% if location.address1 %}
{% set addressline = addressline|merge([location.address1]) %}
{% endif %}
{% if location.address2 %}
{% set addressline = addressline|merge([location.address2]) %}
{% endif %}
{% if location.locality %}
{% set addressline = addressline|merge([location.locality]) %}
{% endif %}
{% if location.city %}
{% set addressline = addressline|merge([location.city]) %}
{% endif %}
{% if location.state %}
{% set addressline = addressline|merge([location.state]) %}
{% endif %}
{% if location.postcode %}
{% set addressline = addressline|merge([location.postcode]) %}
{% endif %}
{% if addressline|length %}
{{addressline|escape|join(', ')}}
{% endif %}
{% endif %}
{% if this.setting('locations__field__phone') and location.phone %}
{% set phone = location.phone|escape %}
{{"[[phone]]"|trans({phone: phone})}}
{% endif %}
{% if this.setting('locations__field__email') and location.email %}
{{"Email"|trans}}
{% endif %}
{% if this.setting('locations__field__website') and location.url %}
{{"Website"|trans}}
{% endif %}
{% if this.setting('locations__field__link_to_descriptive_page') and location.descriptive_page %}
{{"See more..."|trans}}
{% endif %}
{% if this.setting('locations__field__summary') and location.summary %}
{% set description = location.summary|escape %}
{{description}}
{% endif %}
{% if this.setting('locations__field__special_offers') and location.special_offers %}
{{location.special_offers|e}}
{% endif %}
{% if display_custom_dataset_fields_on_the_frontend %}
{% for front_end_field in display_custom_dataset_fields_on_the_frontend %}
{{location[front_end_field]|e}}
{% endfor %}
{% endif %}
{% if Logged_in_user_is_admin and Location_organizer_href_start %}
i
{% endif %}