]> git.agnieray.net Git - galette.git/blob - galette/templates/default/components/forms/input.html.twig
Some slight accessibility related improvements
[galette.git] / galette / templates / default / components / forms / input.html.twig
1 {% if tip_html is defined and tip_html != '' %}
2 {% set tip = tip_html %}
3 {% endif %}
4
5 {% block component %}
6 {% if notag is not defined %}
7 <div{% if component_id is defined %} id="{{ component_id }}"{% endif %} class="{{ component_class ?? 'field' }}{% if required is defined and required == true %} required{% endif %}">
8 {% endif %}
9 {% if type is defined and type == 'checkbox' %}
10 <div class="ui toggle{% if checked is defined and checked == true %} checked{% endif %} right aligned checkbox">
11 {% else %}
12 {% block label %}
13 <label for="{{ id }}"{% if title is defined %} title="{{ title }}"{% endif %}{% if labelclass is defined %} class="{% if labelclass is defined %}{{ labelclass }}{% endif %}"{% endif %}>
14 {% if masschange ?? false %}
15 {# Add a checkbox for fields to change on mass edition #}
16 <input type="checkbox" name="mass_{{ entry.field_id }}" class="mass_checkbox"/>
17 {% endif %}
18 {{ label }}
19 </label>
20 {% endblock %}
21 {% endif %}
22 {% if type is defined and type == 'password' %}
23 <div class="ui input">
24 {% elseif (tip is defined and tip != '') and (type is defined and type == 'text') %}
25 <div class="ui corner labeled input">
26 {% elseif (rightlabel is defined and rightlabel != '') and (type is defined and type == 'text') %}
27 <div class="ui right labeled input">
28 {% elseif search_id is defined %}
29 <div id="{{ search_id }}" class="ui search field input">
30 <div class="ui icon input">
31 {% endif %}
32 {% block element %}
33 <input
34 type="{{ type }}"
35 name="{{ name ?? id }}"
36 id="{{ id }}"
37 value="{% if value is not same as null %}{{ value }}{% endif %}"
38 {% if required is defined and required == true %} required="required"{% endif %}
39 {% if readonly is defined and readonly == true %} readonly="readonly"{% endif %}
40 {% if disabled is defined and disabled == true %} disabled="disabled"{% endif %}
41 {% if title is defined %} title="{{ title }}"{% endif %}
42 {% if maxlength is defined %} maxlength="{{ maxlength }}"{% endif %}
43 {% if elt_class is defined %} class="{{ elt_class }}"{% endif %}
44 {% if autocomplete is defined %} autocomplete="{{ autocomplete }}"{% endif %}
45 {% if autofocus is defined %} autofocus{% endif %}
46 {% if size is defined %} size="{{ size }}"{% endif %}
47 {% if checked is defined and checked == true %} checked{% endif %}
48 />
49 {% endblock %}
50 {% if search_id is defined %}
51 <i class="jsonly displaynone search icon" aria-hidden="true"></i>
52 </div>
53 </div>
54 {% elseif (rightlabel is defined and rightlabel != '') and (type is defined and type == 'text') %}
55 <div class="ui basic label">
56 {{ rightlabel }}
57 </div>
58 </div>
59 {% elseif (tip is defined and tip != '') and (type is defined and type == 'text') %}
60 <div class="ui corner label">
61 <i class="circular inverted primary small icon info tooltip" {% if tip_html is defined %}data-html{% else %}title{% endif %}="{{ tip }}" aria-hidden="true"></i>
62 </div>
63 </div>
64 {% elseif type is defined and type == 'password' %}
65 </div>
66 {% endif %}
67 {% if type is defined and type == 'checkbox' %}
68 {% block label_after %}
69 <label for="{{ id }}"{% if title is defined %} title="{{ title }}"{% endif %}{% if labelclass is defined %} class="{% if labelclass is defined %}{{ labelclass }}{% endif %}"{% endif %}>
70 {% if masschange ?? false %}
71 {# Add a checkbox for fields to change on mass edition #}
72 <input type="checkbox" name="mass_{{ entry.field_id }}" class="mass_checkbox"/>
73 {% endif %}
74 {{ label }}
75 </label>
76 {% endblock %}
77 </div>
78 {% endif %}
79 {% if (tip is defined and tip != '') and (type is defined and type != 'text') %}<i class="circular inverted primary small icon info tooltip" title="{{ tip }}" aria-hidden="true"></i>{% endif %}
80 {% if example is defined %}<span class="exemple">{{ example }}</span>{% endif %}
81 {% if notag is not defined %}
82 </div>
83 {% endif %}
84 {% endblock %}