]> git.agnieray.net Git - galette.git/blob - galette/templates/default/pages/plugins.html.twig
Some slight accessibility related improvements
[galette.git] / galette / templates / default / pages / plugins.html.twig
1 {% extends 'page.html.twig' %}
2
3 {% block content %}
4 <table class="listing ui celled striped table">
5 <!--<caption>{{ _T('Active plugins') }}</caption>-->
6 <thead>
7 <tr>
8 <th class="listing">{{ _T('Name') }}</th>
9 <th class="listing">{{ _T('Description') }}</th>
10 <th class="listing">{{ _T('Author') }}</th>
11 <th class="listing">{{ _T('Version') }}</th>
12 <th class="listing">{{ _T('Release date') }}</th>
13 <th class="listing actions_row"></th>
14 </tr>
15 </thead>
16 <tbody>
17 <tr>
18 <th colspan="6" class="center aligned plugins"><strong>{{ _T('Active plugins') }}</strong></th>
19 </tr>
20 {% for name, plugin in plugins_list %}
21 <tr class="{% if loop.index0 % 2 == 0 %}even{% else %}odd{% endif %}">
22 <td data-scope="row"><a href="{{ url_for(plugin.route ~ "Info", {"plugin": name}) }}" class="info-plugin">{{ plugin.name }} ({{ name }})</a></td>
23 <td data-title="{{ _T('Description') }}">{{ plugin.desc }}</td>
24 <td data-title="{{ _T('Author') }}">{{ plugin.author }}</td>
25 <td data-title="{{ _T('Version') }}">{{ plugin.version }}</td>
26 <td data-title="{{ _T('Release date') }}">{{ plugin.date }}</td>
27 <td class="actions_row">
28 <a
29 href="{{ url_for("pluginsActivation", {"action": "deactivate", "module_id": name}) }}"
30 class="toggleActivation use"
31 >
32 <i class="ui toggle on red icon tooltip" aria-hidden="true"></i>
33 <span class="ui special popup">{{ _T("Click here to deactivate plugin '%name'")|replace({"%name": plugin.name}) }}</span>
34 </a>
35 {% if plugins.needsDatabase(name) %}
36 <a
37 href="{{ url_for("pluginInitDb", {"id": name}) }}"
38 id="initdb_{{ name }}"
39 class="initdb action"
40 >
41 <i class="ui database blue icon tooltip" aria-hidden="true"></i>
42 <span class="ui special popup">{{ _T("Initialize '%name' database")|replace({"%name": plugin.name}) }}</span>
43 </a>
44 {% else %}
45 <i class="ui icon">&nbsp;</i>
46 {% endif %}
47 </td>
48 </tr>
49 {% else %}
50 <tr>
51 <td colspan="6">{{ _T('No active plugin.') }}</td>
52 </tr>
53 {% endfor %}
54 <tr>
55 <th colspan="6" class="center aligned inactives plugins"><strong>{{ _T('Inactive plugins') }}</strong></th>
56 </tr>
57 <thead>
58 <tr>
59 <th class="listing">{{ _T('Name') }}</th>
60 <th class="listing" colspan="4">{{ _T('Cause') }}</th>
61 <th class="listing actions_row"></th>
62 </tr>
63 </thead>
64 {% for name, plugin in plugins_disabled_list %}
65 <tr>
66 <td data-scope="row">{{ name }}</td>
67 <td data-title="{{ _T('Cause') }}" colspan="4">
68 {% if plugin.cause == constant('Galette\\Core\\Plugins::DISABLED_MISS') %}
69 {{ _T('A required file is missing') }}
70 {% elseif plugin.cause == constant('Galette\\Core\\Plugins::DISABLED_COMPAT') %}
71 {{ _T('Incompatible with current version') }}
72 {% elseif plugin.cause == constant('Galette\\Core\\Plugins::DISABLED_EXPLICIT') %}
73 {{ _T('Explicitely disabled') }}
74 {% else %}
75 {{ _T('Unknown') }}
76 {% endif %}
77 </td>
78 <td class="actions_row">
79 <a
80 href="{{ url_for("pluginsActivation", {"action": "activate", "module_id": name}) }}"
81 class="toggleActivation delete"
82 >
83 <i class="ui toggle on grey icon tooltip" aria-hidden="true"></i>
84 <span class="ui special popup">{{ _T("Activate plugin '%name'")|replace({"%name": name}) }}</span>
85 </a>
86 <i class="ui icon">&nbsp;</i>
87 </td>
88 </tr>
89 {% else %}
90 <tr>
91 <td colspan="5">{{ _T('No inactive plugin.') }}</td>
92 </tr>
93 {% endfor %}
94 </tbody>
95 </table>
96 {% endblock %}
97
98 {% block javascripts %}
99 <script type="text/javascript">
100 $(function() {
101 {% if constant('GALETTE_MODE') == 'DEMO' %}
102 $('.initdb, a.toggleActivation').click(function(){
103 {% include "elements/js/modal.js.twig" with {
104 modal_title_twig: _T("Application runs under demo mode. This functionnality is not enabled, sorry.")|e("js"),
105 modal_without_content: true,
106 modal_class: "mini",
107 modal_deny_only: true,
108 modal_cancel_text: _T("Close")|e("js"),
109 modal_classname: "redalert",
110 } %}
111 return false;
112 });
113 {% else %}
114 {# Plugin init popup #}
115 var _btnuser_mapping = function(){
116 $('.initdb').click(function(){
117 var _plugin = this.id.substring(7);
118 var _url = $(this).attr('href');
119 $.ajax({
120 url: _url,
121 type: "GET",
122 {% include "elements/js/loader.js.twig" %},
123 success: function(res){
124 _initdb_dialog(res, _plugin);
125 },
126 error: function() {
127 {% include "elements/js/modal.js.twig" with {
128 modal_title_twig: _T("An error occurred displaying plugin database initialization interface :(")|e("js"),
129 modal_without_content: true,
130 modal_class: "mini",
131 modal_deny_only: true,
132 modal_cancel_text: _T("Close")|e("js"),
133 modal_classname: "redalert",
134 } %}
135 }
136 });
137 return false;
138 });
139 }
140 _btnuser_mapping();
141
142 var _initdb_dialog = function(res, plugin) {
143 var _title = '{{ _T("Plugin database initialization: %name")|e('js') }}';
144 {% include "elements/js/modal.js.twig" with {
145 modal_title: "_title.replace('%name', plugin)",
146 modal_content: "res",
147 modal_class: "initdb-modal large",
148 modal_content_class: "scrolling",
149 modal_other_options: {
150 observeChanges: true,
151 closable: false
152 },
153 modal_onapprove: "$('#plugins_initdb_form').submit();return false;",
154 modal_approve_text: _T("Next step")|e("js"),
155 modal_cancel_text: _T("Close")|e("js")
156 } %}
157 _initdb_bindings(res, plugin);
158 };
159
160 var _initdb_bindings = function(res, plugin){
161 //$('.initdb-modal input:submit, .initdb-modal .button, .initdb-modal input:reset' );
162 $('#plugins_initdb_form').on('submit', function(event) {
163 event.preventDefault();
164 var _form = $(this);
165 var _data = _form.serialize();
166 _data += '&ajax=true&next=true';
167 $.ajax({
168 url: _form.attr('action'),
169 type: "POST",
170 data: _data,
171 datatype: 'json',
172 {% include "elements/js/loader.js.twig" %},
173 success: function(res) {
174 $('#plugins_initdb_form').remove();
175 $('#plugins_initdb_ajax').append(res);
176 if (!$.trim($('#plugins_initdb_form .form-actions').html())){
177 $('.initdb-modal .approve').remove();
178 }
179 _initdb_bindings(res);
180 },
181 error: function() {
182 {% include "elements/js/modal.js.twig" with {
183 modal_title_twig: _T("An error occurred displaying plugin database initialization interface :(")|e("js"),
184 modal_without_content: true,
185 modal_class: "mini",
186 modal_deny_only: true,
187 modal_cancel_text: _T("Close")|e("js"),
188 modal_classname: "redalert",
189 } %}
190 }
191 });
192 });
193 };
194
195 $('.info-plugin').click(function(event){
196 event.preventDefault();
197 var _this = $(this);
198 var _url = _this.attr('href');
199 $.ajax({
200 url: _url,
201 type: "GET",
202 datatype: 'json',
203 {% include "elements/js/loader.js.twig" %},
204 success: function(res) {
205 var _content = $($.parseHTML(res)).find('div.main-content').children();
206 {% include "elements/js/modal.js.twig" with {
207 modal_title: "_this.html()",
208 modal_content: "_content",
209 modal_class: "large",
210 modal_content_class: "scrolling",
211 modal_deny_only: true,
212 modal_cancel_text: _T("Close")|e("js")
213 } %}
214 },
215 error: function() {
216 {% include "elements/js/modal.js.twig" with {
217 modal_title_twig: _T("An error occurred :(")|e("js"),
218 modal_without_content: true,
219 modal_class: "mini",
220 modal_deny_only: true,
221 modal_cancel_text: _T("Close")|e("js"),
222 modal_classname: "redalert",
223 } %}
224 }
225 });
226 });
227 {% endif %}
228 });
229 </script>
230 {% endblock %}