6 * Copyright © 2009-2023 The Galette Team
8 * This file is part of Galette (https://galette.eu).
10 * Galette is free software: you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation, either version 3 of the License, or
13 * (at your option) any later version.
15 * Galette is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
20 * You should have received a copy of the GNU General Public License
21 * along with Galette. If not, see <https://www.gnu.org/licenses/>.
23 * @category Authentication
26 * @author Guillaume Agniéray <dev@agnieray.net>
27 * @author Johan Cwiklinski <johan@x-tnd.be>
28 * @copyright 2009-2023 The Galette Team
29 * @license https://www.gnu.org/licenses/gpl-3.0.html GPL License 3.0 or later
30 * @link https://galette.eu
31 * @since Available since 1.0dev - 2023-02-23
33 * Available variables:
35 * - modal_selector: existing inline HTML modal.
36 * - modal_without_title: true to hide modal's header.
37 * - modal_title: value coming from js code.
38 * - modal_title_twig: value coming from twig.
39 * - modal_without_content: true to hide modal's content.
40 * - modal_content: value coming from js code.
41 * - modal_content_twig: value coming from twig.
42 * - modal_class: class(es) applied on modal.
43 * - modal_content_class: class(es) applied on modal's content.
44 * - modal_other_options: hash to add other options { option: value }.
45 * - modal_onshow: modal's onShow callback.
46 * - modal_onhidden: modal's onHidden callback.
47 * - modal_onapprove: modal's onApprove callback.
48 * - modal_ondeny: modal's onDeny callback.
49 * - modal_additional_button: hash to add a third button { text, icon, color, click }.
50 * - modal_deny_only: true hides the approve button.
51 * - modal_approve_text: modal's approve button's text.
52 * - modal_approve_icon: modal's approve button's icon.
53 * - modal_approve_color: modal's approve button's color.
54 * - modal_approve_click: modal's approve button's onclick event.
55 * - modal_cancel_text: modal's cancel button's icon.
56 * - modal_cancel_icon: modal's cancel button's icon.
57 * - modal_cancel_color: modal's cancel button's icon.
58 * - modal_cancel_click: modal's cancel button's onclick event.
59 * - modal_classname: string to override default Fomantic UI classes.
64 {% if modal_selector is not defined %}
66 {% if modal_without_title is not defined %}
67 title: {% if modal_title_twig is defined %}'{{ modal_title_twig }}'{% elseif modal_title is defined %}{{ modal_title|raw }}{% endif %},
69 {% if modal_without_content is not defined %}
70 content: {% if modal_content_twig is defined %}'{{ modal_content_twig }}'{% elseif modal_content is defined %}{{ modal_content|raw }}{% endif %},
73 $('{{ modal_selector }}').modal({
75 class: 'modal-form{% if modal_class is defined %} {{ modal_class }}{% endif %}',
76 classContent: '{% if modal_content_class is defined %}{{ modal_content_class }}{% endif %}',
77 {% if modal_other_options is defined and modal_other_options is iterable %}
78 {% for key, value in modal_other_options %}
79 {% if key == "observeChanges" and value == "1" %}
82 {{ key }}: "{{ value }}",
87 {% if modal_onshow is defined %}
88 {{ modal_onshow|raw }}
93 onHidden: function() {
94 {% if modal_onhidden is defined %}
95 {{ modal_onhidden|raw }}
100 onApprove: function() {
101 {% if modal_onapprove is defined %}
102 {{ modal_onapprove|raw }}
103 {% elseif modal_deny_only is not defined %}
104 $('.modal-form form').submit();
108 {% if modal_ondeny is defined %}
109 {{ modal_ondeny|raw }}
113 {% if modal_additional_button is defined and modal_additional_button is iterable %}
115 {% for key, value in modal_additional_button %}
116 {% if key == "click" %}
117 {{ key }}: {{ value|raw }},
119 {{ key }}: "{{ value }}",
124 {% if modal_deny_only is not defined %}
126 text: '{% if modal_approve_text is not defined %}{{ _T("Continue")|e("js") }}{% else %}{{ modal_approve_text }}{% endif %}',
127 icon: '{% if modal_approve_icon is not defined %}arrow right{% else %}{{ modal_approve_icon }}{% endif %}',
128 class: '{% if modal_approve_color is not defined %}primary{% else %}{{ modal_approve_color }}{% endif %} icon labeled approve',
130 {% if modal_approve_click is defined %}
131 {{ modal_approve_click|raw }}
137 text: '{% if modal_cancel_text is not defined %}{{ _T("Cancel")|e("js") }}{% else %}{{ modal_cancel_text }}{% endif %}',
138 icon: '{% if modal_cancel_icon is not defined %}times{% else %}{{ modal_cancel_icon }}{% endif %}',
139 class: '{% if modal_cancel_color is defined %}{{ modal_cancel_color }} {% endif %}icon labeled cancel',
141 {% if modal_cancel_click is defined %}
142 {{ modal_cancel_click|raw }}
147 {% if modal_classname is defined %}
148 {% if modal_classname == "redalert" %}
150 modal: 'ui redalert modal',
151 title: 'center aligned header',
152 content: 'center aligned content',
153 actions: 'center aligned actions'
157 {{ modal_classname|raw }}