]> git.agnieray.net Git - galette.git/blob - galette/templates/default/elements/messages_inline.html.twig
Fix flash messages merge, rename some variables
[galette.git] / galette / templates / default / elements / messages_inline.html.twig
1 {# Let's see if there are loginfault messages to show #}
2 {% set loginfaults = flash.getMessage('loginfault') %}
3 {% if loginfault_detected is defined and loginfault_detected is iterable %}
4 {% for l in loginfault_detected %}
5 {% set loginfaults = loginfaults|merge([l]) %}
6 {% endfor %}
7 {% endif %}
8
9 {# Let's see if there are error messages to show #}
10 {% set errors = flash.getMessage('error_detected') ?? [] %}
11 {% set errors = errors|merge(flash.getMessage('error') ?? []) %}
12 {% set errors = errors|merge(loginfaults ?? []) %}
13 {% if error_detected is defined and error_detected is iterable %}
14 {% for e in error_detected %}
15 {% set errors = errors|merge([e]) %}
16 {% endfor %}
17 {% endif %}
18 {% if errors is iterable and errors|length > 0 %}
19 <noscript>
20 <div class="ui error icon message">
21 <i class="exclamation circle icon" aria-hidden="true"></i>
22 <div class="content">
23 <div class="header">{{ _T("- ERROR -") }}</div>
24 {% if errors|length > 1 %}
25 <ul class="list">
26 {% for error in errors %}
27 <li>{{ error|raw }}</li>
28 {% endfor %}
29 </ul>
30 {% else %}
31 {% for error in errors %}
32 <p>{{ error|raw }}</p>
33 {% endfor %}
34 {% endif %}
35 </div>
36 </div>
37 </noscript>
38 {% endif %}
39
40 {# Let's see if there are warning messages to show #}
41 {% set warnings = flash.getMessage('warning_detected') ?? [] %}
42 {% set warnings = warnings|merge(flash.getMessage('warning') ?? []) %}
43 {% if warning_detected is defined and warning_detected is iterable %}
44 {% for w in warning_detected %}
45 {% set warnings = warnings|merge([w]) %}
46 {% endfor %}
47 {% endif %}
48 {% if warnings is iterable and warnings|length > 0 %}
49 <noscript>
50 <div class="ui warning icon message">
51 <i class="exclamation triangle icon" aria-hidden="true"></i>
52 <div class="content">
53 <div class="header">{{ _T("- WARNING -") }}</div>
54 {% if warnings|length > 1 %}
55 <ul class="list">
56 {% for warning in warnings %}
57 <li>{{ warning|raw }}</li>
58 {% endfor %}
59 </ul>
60 {% else %}
61 {% for warning in warnings %}
62 <p>{{ warning|raw }}</p>
63 {% endfor %}
64 {% endif %}
65 </div>
66 </div>
67 </noscript>
68 {% endif %}
69
70 {# Let's see if there are success messages to show #}
71 {% set success = flash.getMessage('success_detected') ?? [] %}
72 {% set success = success|merge(flash.getMessage('success') ?? []) %}
73 {% if success_detected is defined and success_detected is iterable %}
74 {% for entry in success_detected %}
75 {% set success = success|merge([entry]) %}
76 {% endfor %}
77 {% endif %}
78 {% if success is iterable and success|length > 0 %}
79 <noscript>
80 <div class="ui success icon message">
81 <i class="check circle outline icon" aria-hidden="true"></i>
82 <i class="window close outline icon" aria-hidden="true"></i>
83 <div class="content">
84 {% if success|length > 1 %}
85 <ul class="list">
86 {% for entry in success %}
87 <li>{{ entry|raw }}</li>
88 {% endfor %}
89 </ul>
90 {% else %}
91 {% for entry in success %}
92 <p>{{ entry|raw }}</p>
93 {% endfor %}
94 {% endif %}
95 </div>
96 </div>
97 </noscript>
98 {% endif %}
99
100 {# Let's see if there are info messages to show #}
101 {% set info = flash.getMessage('info_detected') ?? [] %}
102 {% set info = info|merge(flash.getMessage('info') ?? []) %}
103 {% if info_detected is defined and info_detected is iterable %}
104 {% for i in info_detected %}
105 {% set info = info|merge([i]) %}
106 {% endfor %}
107 {% endif %}
108 {% if info is iterable and info|length > 0 %}
109 <noscript>
110 <div class="ui info icon message">
111 <i class="info icon" aria-hidden="true"></i>
112 <div class="content">
113 {% if info|length > 1 %}
114 <ul class="list">
115 {% for i in info %}
116 <li>{{ i|raw }}</li>
117 {% endfor %}
118 </ul>
119 {% else %}
120 {% for entry in info %}
121 {% set info_title = '' %}
122 {% set info_message = entry %}
123 {% if entry is iterable %}
124 {% set info_title = entry.title %}
125 <p class="header">{{ info_title }}</p>
126 {% set info_message = entry.message %}
127 {% endif %}
128 <p>{{ entry|raw }}</p>
129 {% endfor %}
130 {% endif %}
131 </div>
132 </div>
133 </noscript>
134 {% endif %}
135
136 {# Renew telemetry #}
137 {% if renew_telemetry is defined and renew_telemetry %}
138 {% include "modals/telemetry.html.twig" with {part: "dialog"} %}
139 <noscript>
140 <div class="ui info icon message" id="renewbox">
141 <i class="info icon" aria-hidden="true"></i>
142 <div class="content">
143 <div class="header">{{ _T("Your telemetry data are more than one year old.") }}</div>
144 <p>{{ _T("Do you want to send it again?") }}</p>
145 <a href="#" id="telemetry" class="ui large green button">{{ _T("Yes") }}</a>
146 <a href="#" id="norenew" class="ui large red button">{{ _T("No") }}</a>
147 <a href="#" id="renewlater" class="ui large blue button">{{ _T("Later") }}</a>
148 </div>
149 </div>
150 </noscript>
151 {% endif %}