{% set nb_displayed_aggregations = 5 %} {% macro breadcrum_toolbar(result, url=None, exports=None) %} {% if kwargs %} {% set to_url = result.query.to_url %} {% if in_url('sort') %} {% if request.args.sort.startswith('-') %} {% set current_sort, current_order = request.args.sort[1:], 'desc' %} {% else %} {% set current_sort, current_order = request.args.sort, 'asc' %} {% endif %} {% if current_sort in kwargs %} {% set label, default_order = kwargs[current_sort] %} {% endif %} {% endif %} {% endif %} {{ _('Sort by') }}
{% if current_sort and current_order and default_order %} {% set btn_class = 'btn-default' if current_order == default_order else 'btn-warning' %} {% endif %} {% if result.total and exports %} {% endif %} {% endmacro %} {% macro filter_label(name, label, icon=None, labelize=None) %} {% set values = request.args.getlist(name) or [] %} {% for value in values %} {% if icon %} {% endif %} {{ labelize(value) if labelize else value }} {% endfor %} {% endmacro %} {% macro facet_panel(result, name, label, icon=None, url=None, classes='list-group') %}

{{ label or name }} {% if in_url(name) %} {% endif %}

{{ caller() }}
{% endmacro %} {% macro terms_facet(result, name, label, icon, url=None) %} {% set terms = result.facets[name] %} {% if terms|length > 1 %} {% call facet_panel(result, name, label, icon, url) %} {% for term, count, selected in terms[:nb_displayed_aggregations] %} {{ count }} {{ result.query.facets[name].labelize(term) }} {% endfor %} {% if terms|length > nb_displayed_aggregations %}
{% for term, count, selected in terms[nb_displayed_aggregations:] %} {{ count }} {{ result.query.facets[name].labelize(term) }} {% endfor %}
{% endif %} {% endcall %} {% endif %} {% endmacro %} {% macro model_terms_facet(result, name, label, icon, url=None) %} {% set objects = result.facets[name] %} {% if objects|length > 1 %} {% call facet_panel(result, name, label, icon, url) %} {% for obj, count, selected in objects[:nb_displayed_aggregations] %} {{ count }} {{ result.query.facets[name].labelize(obj) }} {% endfor %} {% if objects|length > nb_displayed_aggregations %}
{% for obj, count, selected in objects[nb_displayed_aggregations:] %} {{ count }} {{ result.query.facets[name].labelize(obj) }} {% endfor %}
{% endif %} {% endcall %} {% endif %} {% endmacro %} {% macro range_facet(result, name, label, icon, url=None) %} {% set ranges = result.facets[name] %} {% if ranges|length > 1 %} {% call facet_panel(result, name, label, icon, url) %} {% for key, count, selected in ranges %} {{ count }} {{ result.query.facets[name].labelize(key) }} {% endfor %} {% endcall %} {% endif %} {% endmacro %} {% macro temporal_coverage_facet(result, name, label, icon, url=None) %} {% set coverage = result.facets[name] %} {% if coverage and coverage.days > 2 %} {% call facet_panel(result, name, label, icon, url, classes='panel-body temporal-coverage') %} {% endcall %} {% endif %} {% endmacro %} {% macro panel_header(result, csv_endpoint=None) %}
{% if result.total %} {{ _('Results %(start)s to %(end)s on %(total)s found', start=result.page_start, end=result.page_end, total=result.total, ) }} {% if csv_endpoint %} CSV {% endif %} {% else %} {{ _('No result found') }} {% endif %}
{% endmacro %} {# Display the site search component with raw html fallback #} {% set default_action = url_for('search.index') %} {% set default_placeholder = _('Search') %} {% macro site_search(action=default_action, placeholder=default_placeholder, territory=None, size=None, class=None) -%}
{%- endmacro %}