]> git.agnieray.net Git - galette.git/blob - galette/templates/default/pages/configuration_dynamic_translations.html.twig
30540c4a2d11b97debc28d902bd4e30f005a654f
[galette.git] / galette / templates / default / pages / configuration_dynamic_translations.html.twig
1 {% extends (mode == 'ajax') ? "ajax.html.twig" : "page.html.twig" %}
2
3 {% block content %}
4 {% if trans is defined and trans|length > 0 %}
5 {% if exists and mode != 'ajax' %}
6 <div class="ui top attached accordion-styled header">
7 {{ _T("Choose label to translate") }}
8 </div>
9 <div class="ui bottom attached accordion-styled segment">
10 <form action="{{ url_for('dynamicTranslations') }}" method="get" enctype="multipart/form-data" id="select_orig" class="ui form">
11 <div class="field inline">
12 <select name="text_orig" id="text_orig" class="ui dropdown nochosen">
13 {% for value in orig %}
14 <option value="{{ value }}"{% if value == text_orig %} selected="selected"{% endif %}>{{ value }}</option>
15 {% endfor %}
16 </select>
17 <noscript> <span><input type="submit" value="{{ _T("Change") }}" class="ui button" /></span></noscript>
18 {% include "components/forms/csrf.html.twig" %}
19 </div>
20 </form>
21 </div>
22 {% endif %}
23
24 <form action="{{ url_for('editDynamicTranslation') }}" method="post" enctype="multipart/form-data" class="ui equal width form">
25 {% if not exists %}
26 <div class="field">
27 <label>{{ _T("Original text: '%s'")|replace({'%s': text_orig|escape}) }}</label>
28 <input type="hidden" name="new" value="true"/>
29 </div>
30 {% endif %}
31 <div class="ui top attached accordion-styled header">
32 {{ _T("Translation of '%s' label")|replace({'%s': text_orig}) }}
33 </div>
34 <div class="ui bottom attached accordion-styled segment">
35 <div class="active content field">
36 <table class="ui striped table">
37 {% for k, text in trans %}
38 <tr>
39 <td class="three wide"><label for="text_trans_{{ text.key }}">{{ text.name }}</label></td>
40 <td class="thirteen wide">
41 <input type="text" name="text_trans_{{ text.key }}" id="text_trans_{{ text.key }}" value="{% if text.text %}{{ text.text|escape }}{% endif %}"/>
42 </td>
43 </tr>
44 {% endfor %}
45 </table>
46 <input type=hidden name="text_orig" value="{{ text_orig|escape }}"/>
47 </div>
48 </div>
49 {% if mode != 'ajax' %}
50 <div class="ui basic center aligned segment">
51 <button type="submit" name="trans" class="ui labeled icon primary button action">
52 <i class="save icon"></i> {{ _T("Save") }}
53 </button>
54 </div>
55 {% else %}
56 <input type="hidden" name="trans" id="trans" value="true"/>
57 <input type="hidden" name="redirect_uri" id="redirect_uri" value=""/>
58 {% endif %}
59 {% include "components/forms/csrf.html.twig" %}
60 </form>
61 {% else %}
62 <p>{{ _T("No fields to translate.") }}</p>
63 {% endif %}
64 {% endblock %}
65
66 {% block javascripts %}
67 {% if trans is defined and trans|length > 0 %}
68 {% if exists %}
69 <script type="text/javascript">
70 $('#text_orig').change(function(e) {
71 e.preventDefault();
72 var _selected = $('#text_orig option:selected').val();
73 var _form = $('#select_orig');
74 _form.attr('action', _form.attr('action') + '/' + _selected)
75 $('#select_orig').submit();
76 });
77 </script>
78 {% endif %}
79 {% endif %}
80 {% endblock %}