]> git.agnieray.net Git - galette.git/blob - galette/templates/default/macros.twig
Disable touch events on most tooltips
[galette.git] / galette / templates / default / macros.twig
1 {% macro renderMenu(title, icon, items, mode) %}
2 {% set my_routes = [] %}
3 {% for item in items %}
4 {% set my_routes = my_routes|merge([item.route.name])|merge(item.route.aliases ?? []) %}
5 {% endfor %}
6 {% if mode == "compact" %}
7 <div class="ui{% if cur_route in my_routes %} active-menu{% endif %} dropdown navigation item tooltip" data-html="{{ title }}" data-position="right center">
8 <i class="{{ icon }} icon" aria-hidden="true"></i>
9 <span class="visually-hidden">{{ title }}</span>
10 <i class="dropdown icon" aria-hidden="true"></i>
11 <div class="menu">
12 {% for item in items %}
13 {{ _self.renderMenuItem(item.label, item.title ?? null, item.route, item.icon ?? null, null, 'right center') }}
14 {% endfor %}
15 </div>
16 </div>
17 {% else %}
18 <div class="item">
19 <div class="image header title{% if cur_route in my_routes %} active{% endif %}" data-fold="fold-{{ icon|replace({' ': '-'}) }}" tabindex="0">
20 <i class="{{ icon }} icon" aria-hidden="true"></i>
21 {{ title }}
22 <i class="dropdown icon" aria-hidden="true"></i>
23 </div>
24 <div class="content{% if cur_route in my_routes %} active{% endif %}">
25 {% for item in items %}
26 {{ _self.renderMenuItem(item.label, item.title ?? null, item.route, item.icon ?? null, null, null, mode) }}
27 {% endfor %}
28 </div>
29 </div>
30 {% endif %}
31 {% endmacro %}
32
33 {% macro renderMenuItem(label, title, route, icon, class, tips_position, mode) %}
34 {% if class is empty %}
35 {% if is_current_url(route.name, route.args|default([])) or (cur_route in route.aliases ?? [] and route.sub_select ?? true == true) %}
36 {% set class = "active item" %}
37 {% else %}
38 {% set class = "item" %}
39 {% endif %}
40 {% endif %}
41 <a
42 href="{{ url_for(route.name, route.args|default([])) }}"
43 class="{{ class }}"
44 {% if title %}title="{{ title }}"{% endif %}
45 {% if tips_position %}data-position="{{ tips_position }}"{% endif %}
46 {% if mode != "default" %}tabindex="-1"{% endif %}
47 >
48 {% if icon %}
49 <i class="{{ icon }} icon" aria-hidden="true"></i>
50 {% endif %}
51 {{ label }}
52 </a>
53 {% endmacro %}
54
55 {% macro dashboardCard(label, title, route, icon) %}
56 <a class="ui card" href="{{ url_for(route.name, route.args|default([])) }}" title="{{ title }}">
57 <div class="content">
58 <div class="ui header">
59 <em data-emoji="{{ icon }}" class="medium" aria-hidden="true"></em>
60 <div class="content">
61 {{ label }}
62 </div>
63 </div>
64 </div>
65 </a>
66 {% endmacro %}
67
68 {% macro drawListAction(title, route, icon, extra_class) %}
69 <a
70 href="{{ url_for(route.name, route.args|default([])) }}"
71 class="{{ extra_class|default('') }} tooltip"
72 title="{{ title }}"
73 >
74 <i class="ui {{ icon }} icon" aria-hidden="true"></i>
75 <span class="visually-hidden">{{ title }}</span>
76 </a>
77 {% endmacro %}
78
79 {% macro drawDetailedAction(label, title, route, icon) %}
80 <a
81 href="{{ url_for(route.name, route.args|default([])) }}"
82 title="{{ title }}"
83 class="ui item"
84 >
85 <i class="{{ icon }} icon" aria-hidden="true"></i>
86 {{ label }}
87 </a>
88 {% endmacro %}
89
90 {% macro drawBatchActionsList(batch_actions) %}
91 <div class="checkboxes ui basic horizontal segments">
92 <div class="ui basic fitted segment batch-selection">
93 <div class="ui blue tertiary dropdown icon button batch-select-action">
94 <i class="tasks icon" aria-hidden="true"></i>
95 {{ _T('For the selection:') }}
96 <i class="dropdown icon" aria-hidden="true"></i>
97 <div class="menu">
98 {% for batch_action in batch_actions %}
99 {{ _self.drawBatchAction(batch_action.name, batch_action.label, batch_action.icon, batch_action.title ?? null) }}
100 {% endfor %}
101 </div>
102 </div>
103 </div>
104 </div>
105 {% endmacro %}
106
107 {% macro drawBatchAction(name, label, icon, title) %}
108 <span class="ui item batch-action batch-{{ name }}" data-value="{{ name }}"{% if title %} title="{{ title }}"{% endif %}>
109 <i class="{{ icon }} icon" aria-hidden="true"></i> {{ label }}
110 </span>
111 {% endmacro %}