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

settingsMacros.twig « templates « Morpheus « plugins - github.com/matomo-org/matomo.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: c09aa608eb0b153da48fbb863caf08c08a390121 (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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
{% macro singleSetting(setting, index = 0) %}

    {% set settingValue = setting.getValue %}

    <div class="form-group">

        {% if setting.introduction %}
            <p class="settingIntroduction">{{ setting.introduction }}</p>
        {% endif %}

        {{ _self.field(setting, index) }}

    </div>

{% endmacro %}

{% macro field(setting, index = -1) %}

    {% if index == -1 %}
        {% set index = setting.getName %}
    {% endif %}

    {% set settingValue = setting.getValue %}

        {% if setting.uiControl != 'checkbox' %}
            <label>{{ setting.title }}</label>
        {% endif %}

        {% if setting.inlineHelp %}
            <div class="form-help">
                {{ setting.inlineHelp }}
                {% if setting.defaultValue and setting.uiControl != 'checkbox' and setting.uiControl != 'radio' %}
                    <br/>
                    {{ 'General_Default'|translate }}:
                    {% if setting.defaultValue is iterable %}
                        {{ setting.defaultValue|join(', ')|truncate(50) }}
                    {% else %}
                        {{ setting.defaultValue|truncate(50) }}
                    {% endif %}
                {% endif %}
            </div>
        {% endif %}

        {% if setting.uiControl == 'select' or setting.uiControl == 'multiselect' %}
                    <select
                        {% for attr, val in setting.uiControlAttributes %}
            {{ attr|e('html_attr') }}="{{ val|e('html_attr') }}"
        {% endfor %}
                        name="{{ setting.getKey|e('html_attr') }}"
                        {% if setting.uiControl == 'multiselect' %}multiple{% endif %}>

                        {% for key, value in setting.availableValues %}
            <option value='{{ key }}'
                    {% if settingValue is iterable and key in settingValue %}
                selected='selected'
            {% elseif settingValue==key %}
                selected='selected'
                    {% endif %}>
                {{ value }}
            </option>
        {% endfor %}

                    </select>
                {% elseif setting.uiControl == 'textarea' %}
                    <textarea style="width: 376px; height: 250px;"
                        {% for attr, val in setting.uiControlAttributes %}
            {{ attr|e('html_attr') }}="{{ val|e('html_attr') }}"
        {% endfor %}
                        name="{{ setting.getKey|e('html_attr') }}"
                        >
                        {{- settingValue -}}
                    </textarea>
                {% elseif setting.uiControl == 'radio' %}

            {% for key, value in setting.availableValues %}
                <label class="radio">
                    <input
                            id="name-value-{{ index }}"
                    {% for attr, val in setting.uiControlAttributes %}
                        {{ attr|e('html_attr') }}="{{ val|e('html_attr') }}"
                    {% endfor %}
                    {% if settingValue is sameas(key) %}
                        checked="checked"
                    {% endif %}
                    type="radio"
                    value="{{ key|e('html_attr') }}"
                    name="{{ setting.getKey|e('html_attr') }}" />

                    {{ value }}

                    {% if setting.description %}
                        <span class='form-description'>{{ setting.description }}</span>
                    {% endif %}

                </label>
            {% endfor %}

        {% elseif setting.uiControl == 'checkbox' %}

            <label class="checkbox">
                <input id="name-value-{{ index }}"
                {% for attr, val in setting.uiControlAttributes %}
                    {{ attr|e('html_attr') }}="{{ val|e('html_attr') }}"
                {% endfor %}
                value="1"
                {% if settingValue %}
                    checked="checked"
                {% endif %}
                type="checkbox"
                name="{{ setting.getKey|e('html_attr') }}">

                {{ setting.title }}

                {% if setting.description %}
                    <span class='form-description'>{{ setting.description }}</span>
                {% endif %}
            </label>

        {% else %}

            <input
            {% for attr, val in setting.uiControlAttributes %}
                {{ attr|e('html_attr') }}="{{ val|e('html_attr') }}"
            {% endfor %}
            class="control_{{ setting.uiControl|e('html_attr') }}"
            type="{{ setting.uiControl|e('html_attr') }}"
            name="{{ setting.getKey|e('html_attr') }}"
            value="{{ settingValue|e('html_attr') }}">

        {% endif %}

        {% if setting.uiControl != 'checkbox' and setting.uiControl != 'radio' %}
            <span class='form-description'>{{ setting.description }}</span>
        {% endif %}


{% endmacro %}