Welcome to mirror list, hosted at ThFree Co, Russian Federation.

macros.twig « templates « CoreVisualizations « plugins - github.com/matomo-org/matomo.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 43d8c2158e07fd292447ffaa57fba75cafe08a77 (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
33
34
{% macro singleSparkline(sparkline, allMetricsDocumentation) %}
    <div class="sparkline">
        {% if sparkline.url %}{{ sparkline(sparkline.url)|raw }}{% endif %}
        {% for metric in sparkline.metrics %}
            <span {% if allMetricsDocumentation[metric.column] is defined and allMetricsDocumentation[metric.column] %}title="{{ allMetricsDocumentation[metric.column] }}"{% endif %}>
            {% 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 %}
            </span>
        {% 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 %}