maloja/web/jinja/snippets/timeselection.jinja
{% set allkeys = [filterkeys,limitkeys,delimitkeys,amountkeys,specialkeys] | combine_dicts %}
{% if limitkeys != {} %}
<div>
{% set thisrange = limitkeys.timerange %}
{% set prevrange = thisrange.next(-1) %}
{% set nextrange = thisrange.next(1) %}
{% if prevrange is not none %}
<a href='{{ mlj_uri.create_uri("",filterkeys,limitkeys,delimitkeys,specialkeys,{'timerange':prevrange}) }}'><span class='stat_selector'>{{ prevrange.desc() }}</span></a>
«
{% endif %}
{% if prevrange is not none or nextrange is not none %}
<span class='stat_selector' style='opacity:0.5;'>{{ thisrange.desc() }}</span>
{% endif %}
{% if nextrange is not none %}
»
<a href='{{ mlj_uri.create_uri("",filterkeys,limitkeys,delimitkeys,specialkeys,{'timerange':nextrange}) }}'><span class='stat_selector'>{{ nextrange.desc() }}</span></a>
{% endif %}
</div>
<div>
{% for r in xcurrent %}
{% if r.range == limitkeys.timerange %}
<span class='stat_selector' style='opacity:0.5;'>{{ r.localisation }}</span>
{% elif r.heavy and settings['DISCOURAGE_CPU_HEAVY_STATS'] %}
<span class='stat_selector blocked' title="CPU heavy statistics are discouraged at the moment.">{{ r.localisation }}</span>
{% else %}
<a href='{{ mlj_uri.create_uri("",allkeys,{"timerange":r.range}) }}'><span class='stat_selector'>{{ r.localisation }}</span></a>
{% endif %}
{{ "|" if not loop.last }}
{% endfor %}
</div>
{% endif %}
{% if delimitkeys != {} %}
<div>
{% for cat in [xdelimiters,xtrails] %}
{% for r in cat %}
{# {% if all(r.keys[k] == allkeys[k] for k in r.keys) %} #}
{% if r.replacekeys | map('compare_key_in_dicts',r.replacekeys,allkeys) | alltrue %}
<span class='stat_selector' style='opacity:0.5;'>{{ r.localisation }}</span>
{% elif r.heavy and settings['DISCOURAGE_CPU_HEAVY_STATS'] %}
<span class='stat_selector blocked' title="CPU heavy statistics are discouraged at the moment.">{{ r.localisation }}</span>
{% else %}
<a href='{{ mlj_uri.create_uri("",allkeys,r.replacekeys) }}'><span class='stat_selector'>{{ r.localisation }}</span></a>
{% endif %}
{{ "|" if not loop.last }}
{% endfor %}
<br/>
{% endfor %}
</div>
{% endif %}
<!-- we do this only for things filtered by artist (to include or not include their subunits etc), but NOT for get_performance
since it's more intuitive to fall under the separate/combined logic below -->
{% if ('artist' in filterkeys) and (not artistchart) %}
<div>
{% for o in xassociated %}
{% if o.replacekeys | map('compare_key_in_dicts',o.replacekeys,allkeys) | alltrue %}
<span style='opacity:0.5;'>{{ o.localisation }}</span>
{% else %}
<a href='{{ mlj_uri.create_uri("",allkeys,o.replacekeys) }}'><span>{{ o.localisation }}</span></a>
{% endif %}
{{ "|" if not loop.last }}
{% endfor %}
</div>
{% endif %}
{% if artistchart %}
<div>
{% for o in xseparate %}
{% if o.replacekeys | map('compare_key_in_dicts',o.replacekeys,allkeys) | alltrue %}
<span style='opacity:0.5;'>{{ o.localisation }}</span>
{% else %}
<a href='{{ mlj_uri.create_uri("",allkeys,o.replacekeys) }}'><span>{{ o.localisation }}</span></a>
{% endif %}
{{ "|" if not loop.last }}
{% endfor %}
</div>
{% endif %}