]> git.agnieray.net Git - galette.git/commitdiff
More options for the input template
authorGuillaume AGNIERAY <dev@agnieray.net>
Mon, 27 Feb 2023 18:38:57 +0000 (19:38 +0100)
committerJohan Cwiklinski <johan@x-tnd.be>
Wed, 1 Mar 2023 06:54:26 +0000 (07:54 +0100)
galette/templates/default/components/forms/input.html.twig

index cbe488abd1268929c6449294bbbf49604e593194..feafeb3e2371936a329d941b9775e56ccdf32e9b 100644 (file)
@@ -1,3 +1,7 @@
+{% if tip_html is defined and tip_html != '' %}
+    {% set tip = tip_html %}
+{% endif %}
+
 {% block component %}
 {% if notag is not defined %}
 <div{% if component_id is defined %} id="{{ component_id }}"{% endif %} class="{{ component_class ?? 'field' }}{% if required is defined and required == true %} required{% endif %}">
         </label>
     {% endblock %}
     {% endif %}
-    {% if type is defined and type == 'password' %}<div class="ui input">{% endif %}
-    {% if search_id is defined %}<div id="{{ search_id }}" class="ui search field input"><div class="ui icon input">{% endif %}
-    {% block element %}<input
-        type="{{ type }}"
-        name="{{ name ?? id }}"
-        id="{{ id }}"
-        value="{% if value is not same as null %}{{ value }}{% endif %}"
-        {% if required is defined and required == true %} required="required"{% endif %}
-        {% if readonly is defined and readonly == true %} readonly="readonly"{% endif %}
-        {% if disabled is defined and disabled == true %} disabled="disabled"{% endif %}
-        {% if title is defined %} title="{{ title }}"{% endif %}
-        {% if maxlength is defined %} maxlength="{{ maxlength }}"{% endif %}
-        {% if elt_class is defined %} class="{{ elt_class }}"{% endif %}
-        {% if autocomplete is defined %} autocomplete="{{ autocomplete }}"{% endif %}
-        {% if autofocus is defined %} autofocus{% endif %}
-        {% if size is defined %} size="{{ size }}"{% endif %}
-        {% if checked is defined and checked == true %} checked{% endif %}
-        />
+    {% if type is defined and type == 'password' %}
+        <div class="ui input">
+    {% elseif (tip is defined and tip != '') and (type is defined and type == 'text') %}
+        <div class="ui corner labeled input">
+    {% elseif (rightlabel is defined and rightlabel != '') and (type is defined and type == 'text') %}
+        <div class="ui right labeled input">
+    {% elseif search_id is defined %}
+        <div id="{{ search_id }}" class="ui search field input">
+            <div class="ui icon input">
+    {% endif %}
+    {% block element %}
+                <input
+                    type="{{ type }}"
+                    name="{{ name ?? id }}"
+                    id="{{ id }}"
+                    value="{% if value is not same as null %}{{ value }}{% endif %}"
+                    {% if required is defined and required == true %} required="required"{% endif %}
+                    {% if readonly is defined and readonly == true %} readonly="readonly"{% endif %}
+                    {% if disabled is defined and disabled == true %} disabled="disabled"{% endif %}
+                    {% if title is defined %} title="{{ title }}"{% endif %}
+                    {% if maxlength is defined %} maxlength="{{ maxlength }}"{% endif %}
+                    {% if elt_class is defined %} class="{{ elt_class }}"{% endif %}
+                    {% if autocomplete is defined %} autocomplete="{{ autocomplete }}"{% endif %}
+                    {% if autofocus is defined %} autofocus{% endif %}
+                    {% if size is defined %} size="{{ size }}"{% endif %}
+                    {% if checked is defined and checked == true %} checked{% endif %}
+                />
     {% endblock %}
-    {% if search_id is defined %}<i class="jsonly displaynone search icon"></i></div></div>{% endif %}
-    {% if type is defined and type == 'password' %}</div>{% endif %}
+    {% if search_id is defined %}
+                <i class="jsonly displaynone search icon"></i>
+            </div>
+        </div>
+    {% elseif (rightlabel is defined and rightlabel != '') and (type is defined and type == 'text') %}
+            <div class="ui basic label">
+                {{ rightlabel }}
+            </div>
+        </div>
+    {% elseif (tip is defined and tip != '') and (type is defined and type == 'text') %}
+            <div class="ui corner label">
+                <i class="circular inverted primary small icon info tooltip" {% if tip_html is defined %}data-html{% else %}title{% endif %}="{{ tip }}"></i>
+            </div>
+        </div>
+    {% elseif type is defined and type == 'password' %}
+        </div>
+    {% endif %}
     {% if type is defined and type == 'checkbox' %}
     {% block label_after %}
         <label for="{{ id }}"{% if title is defined %} title="{{ title }}"{% endif %}{% if labelclass is defined %} class="{% if labelclass is defined %}{{ labelclass }}{% endif %}"{% endif %}>
@@ -46,9 +74,9 @@
             {{ label }}
         </label>
     {% endblock %}
-        </div>
+    </div>
     {% endif %}
-    {% if tip is defined and tip != '' %}<i class="circular inverted primary small icon info tooltip" title="{{ tip }}"></i>{% endif %}
+    {% if (tip is defined and tip != '') and (type is defined and type != 'text') %}<i class="circular inverted primary small icon info tooltip" title="{{ tip }}"></i>{% endif %}
     {% if example is defined %}<span class="exemple">{{ example }}</span>{% endif %}
 {% if notag is not defined %}
 </div>