{%- macro js_required() -%} {%- endmacro -%} {%- macro no_data_infobox(source) -%}
{%- if source is none or source is undefined -%} {{ data_not_cached() }} {%- else -%} {{ empty_period() }} {%- endif -%}
{%- endmacro -%} {%- macro data_not_cached() -%} {%- endmacro -%} {%- macro empty_period() -%} {{ _("No data available from this period.") }} {%- endmacro -%} {%- macro data_item(data) -%} {%- set len_limit = 14 -%} {%- if data|length > len_limit -%} {{ data | truncate(len_limit, True, "...", 0) }} {%- else -%} {{ data }} {%- endif -%} {%- endmacro -%} {%- macro country_code_flag(cc) -%} {%- endmacro -%} {%- macro country_code_item(data) -%} {{ country_code_flag(data) }}  {{ data }} {%- endmacro -%} {%- macro spinner_overlay(id) -%}
{%- endmacro -%} {%- macro data_box(id, name, source, data_attr) -%}
{{ name }}
{{ spinner_overlay("spinner-{}".format(id)) }}
{% if source %} {% for item in source %} {% endfor %}
{{ loop.index }}. {% if caller %}{{ caller(item[data_attr]) }}{% else %}{{ data_item(item[data_attr]) }}{% endif %} {{ item.count }}
{% else %} {{ no_data_infobox(source) }} {% endif %}
{%- endmacro -%} {%- macro pair_data_box(id, name, source, data_attr1, data_attr2) -%}
{{ name }}
{{ spinner_overlay("spinner-{}".format(id)) }}
{% if source %} {% for item in source %} {% endfor %}
{{ loop.index }}. {{ data_item(item[data_attr1]) }} {{ data_item(item[data_attr2]) }} {{ item.count }}
{% else %} {{ no_data_infobox(source) }} {% endif %}
{%- endmacro -%} {%- macro map_box(id, name, source, label) -%}
{{ spinner_overlay("spinner-{}".format(id)) }} {{ js_required() }} {% if source %} {% else %} {% endif %} {%- endmacro -%} {%- macro line_box(id, name, source, xkey, ykey, label) -%}
{{ name }}
{{ spinner_overlay("spinner-{}".format(id)) }}
{% if source %} {{ morris_line(id, source, xkey, ykey, label) }} {% else %} {{ no_data_infobox(source) }} {% endif %}
{{ js_required() }}
{%- endmacro -%} {%- macro button_line_box(id, name, periods, params, source, xkey, ykey, label) -%}
{{ name }}
{{ spinner_overlay("spinner-{}".format(id)) }} {{ graph_period_buttons(id, periods, params) }}
{% if source %} {{ morris_line(id, source, xkey, ykey, label) }} {% else %} {{ no_data_infobox(source) }} {% endif %}
{%- endmacro -%} {%- macro morris_line(id, source, xkey, ykey, label) -%} {%- endmacro -%} {%- macro big_period_buttons(resource_names, periods, active_params) -%}
{% for period, period_params in periods.items() %} {% endfor %}
{%- endmacro -%} {%- macro graph_period_buttons(resource_name, periods, active_params) -%}
{% for period in periods %} {% endfor %}
{%- endmacro -%} {%- macro request_missing_resources(resource_names, resources, params) -%} {%- endmacro -%}