blob: ffd1885be151c735952367e0b6a5d2fa5cd067ff (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
|
{% macro singleSparkline(sparkline) %}
<div class="sparkline">
{% if sparkline.url %}{{ sparkline(sparkline.url)|raw }}{% endif %}
{% for metric in sparkline.metrics %}
{% if '%s' in metric.description -%}
{{ metric.description|translate("<strong>"~metric.value~"</strong>")|raw }}
{%- else %}
<strong>{{ metric.value }}</strong> {{ metric.description }}
{%- endif %}{% if not loop.last %}, {% endif %}
{% endfor %}
{% if sparkline.evolution is defined %}
{% set evolutionPretty = sparkline.evolution.percent %}
{% if sparkline.evolution.percent < 0 %}
{% set evolutionClass = 'negative-evolution' %}
{% set evolutionIcon = 'arrow_down.png' %}
{% elseif sparkline.evolution.percent == 0 %}
{% set evolutionClass = 'neutral-evolution' %}
{% set evolutionIcon = 'stop.png' %}
{% else %}
{% set evolutionClass = 'positive-evolution' %}
{% set evolutionIcon = 'arrow_up.png' %}
{% set evolutionPretty = '+' ~ sparkline.evolution.percent %}
{% endif %}
<span class="metricEvolution" title="{{ sparkline.evolution.tooltip }}"><img
style="padding-right:4px" src="plugins/MultiSites/images/{{ evolutionIcon }}"/>
<strong class="{{ evolutionClass }}">{{ evolutionPretty }}</strong></span>
{% endif %}
</div>
{% endmacro %}
|