]> git.agnieray.net Git - galette.git/commitdiff
Use better grid on core fields
authorGuillaume AGNIERAY <dev@agnieray.net>
Mon, 20 Feb 2023 20:28:26 +0000 (21:28 +0100)
committerGuillaume AGNIERAY <dev@agnieray.net>
Thu, 23 Feb 2023 09:51:42 +0000 (10:51 +0100)
galette/templates/default/components/form.html.twig

index fcf9cfdd23e8ab043bfe19d23d6b2bc7f47e4065..75190ca0c4bc87ffa5280f3f9735e032eea494d5 100644 (file)
                     {{ _T(fieldset.label) }}
                 </div>
                 <div class="active content field">
-                {% if masschange is not defined and not self_adh and fieldset.id == '1' %}
-                    {% include "components/forms/picture.html.twig" %}
-                {% endif %}
-                {% if groups is defined and groups|length != 0 and loop.last and (masschange is not defined or masschange == false) %}
-                    {% include "components/forms/groups.html.twig" %}
-                {% endif %}
-                {% for entry in fieldset.elements %}
-                    {% if loop.index0 % 3 == 0 %}
-                        <div class="three fields">
-                    {% endif %}
-                    {% set template = "text.html.twig" %}
-                    {% set title = null %}
-                    {% set tip = null %}
-                    {% set size = null %}
-                    {% set propname = entry.propname %}
-                    {% set value = null %}
-                    {% set example = null %}
-
-                    {% if entry.type == constant('Galette\\Entity\\FieldsConfig::TYPE_BOOL') %}
-                        {% set template = "checkbox.html.twig" %}
-                        {% set value = "1" %}
-                    {% endif %}
-                    {% if entry.field_id == 'titre_adh' %}
-                        {% set template = "titles.html.twig" %}
-                        {% set value = member.title %}
-                    {% endif %}
-                    {% if entry.field_id == 'pref_lang' %}
-                        {% set template = "lang.html.twig" %}
-                    {% endif %}
-                    {% if entry.field_id == 'sexe_adh' %}
-                        {% set template = "gender.html.twig" %}
-                    {% endif %}
-                    {% if entry.field_id == 'societe_adh' %}
-                        {% set template = "company.html.twig" %}
-                    {% endif %}
-                    {% if entry.field_id starts with 'date_' or entry.field_id == 'ddn_adh' %}
-                        {% set template = "date.html.twig" %}
+                    <div class="ui three column stackable grid">
+                    {% if masschange is not defined and not self_adh and fieldset.id == '1' %}
+                        <div class="sixteen wide field column">
+                            {% include "components/forms/picture.html.twig" %}
+                        </div>
                     {% endif %}
-                    {% if entry.field_id == 'adresse_adh' %}
-                        {% set template = "address.html.twig" %}
+                    {% if groups is defined and groups|length != 0 and loop.last and (masschange is not defined or masschange == false) %}
+                        <div class="sixteen wide field column">
+                            {% include "components/forms/groups.html.twig" %}
+                        </div>
                     {% endif %}
-                    {% if entry.field_id == 'mdp_adh' %}
-                        {% if not self_adh %}
-                            {% set template = "password.html.twig" %}
-                        {% else %}
-                            {% set template = "captcha.html.twig" %}
+                    {% for entry in fieldset.elements %}
+                        <div class="field column">
+                        {% set template = "text.html.twig" %}
+                        {% set title = null %}
+                        {% set tip = null %}
+                        {% set size = null %}
+                        {% set propname = entry.propname %}
+                        {% set value = null %}
+                        {% set example = null %}
+
+                        {% if entry.type == constant('Galette\\Entity\\FieldsConfig::TYPE_BOOL') %}
+                            {% set template = "checkbox.html.twig" %}
+                            {% set value = "1" %}
                         {% endif %}
-                    {% endif %}
-                    {% if entry.field_id == 'info_adh' or entry.field_id == 'info_public_adh' %}
-                        {% set template = "textarea.html.twig" %}
-                        {% if entry.field_id == 'info_adh' %}
-                            {% set example = _T("This comment is only displayed for admins and staff members.") %}
-                        {% else %}
-                            {% if login.isAdmin() or login.isStaff() %}
-                                {% set example = _T("This comment is reserved to the member.") %}
+                        {% if entry.field_id == 'titre_adh' %}
+                            {% set template = "titles.html.twig" %}
+                            {% set value = member.title %}
+                        {% endif %}
+                        {% if entry.field_id == 'pref_lang' %}
+                            {% set template = "lang.html.twig" %}
+                        {% endif %}
+                        {% if entry.field_id == 'sexe_adh' %}
+                            {% set template = "gender.html.twig" %}
+                        {% endif %}
+                        {% if entry.field_id == 'societe_adh' %}
+                            {% set template = "company.html.twig" %}
+                        {% endif %}
+                        {% if entry.field_id starts with 'date_' or entry.field_id == 'ddn_adh' %}
+                            {% set template = "date.html.twig" %}
+                        {% endif %}
+                        {% if entry.field_id == 'adresse_adh' %}
+                            {% set template = "address.html.twig" %}
+                        {% endif %}
+                        {% if entry.field_id == 'mdp_adh' %}
+                            {% if not self_adh %}
+                                {% set template = "password.html.twig" %}
+                            {% else %}
+                                {% set template = "captcha.html.twig" %}
                             {% endif %}
                         {% endif %}
-                    {% endif %}
-                    {% if entry.field_id == 'activite_adh' %}
-                        {% set template = "account.html.twig" %}
-                    {% endif %}
-                    {% if entry.field_id == 'id_statut' %}
-                        {% set template = "status.html.twig" %}
-                    {% endif %}
-                    {% if entry.field_id == 'ville_adh' or entry.field_id == 'lieu_naissance' or entry.field_id == 'pays_adh' %}
-                        {% set template = "search.html.twig" %}
-                    {% endif %}
+                        {% if entry.field_id == 'info_adh' or entry.field_id == 'info_public_adh' %}
+                            {% set template = "textarea.html.twig" %}
+                            {% if entry.field_id == 'info_adh' %}
+                                {% set example = _T("This comment is only displayed for admins and staff members.") %}
+                            {% else %}
+                                {% if login.isAdmin() or login.isStaff() %}
+                                    {% set example = _T("This comment is reserved to the member.") %}
+                                {% endif %}
+                            {% endif %}
+                        {% endif %}
+                        {% if entry.field_id == 'activite_adh' %}
+                            {% set template = "account.html.twig" %}
+                        {% endif %}
+                        {% if entry.field_id == 'id_statut' %}
+                            {% set template = "status.html.twig" %}
+                        {% endif %}
+                        {% if entry.field_id == 'ville_adh' or entry.field_id == 'lieu_naissance' or entry.field_id == 'pays_adh' %}
+                            {% set template = "search.html.twig" %}
+                        {% endif %}
 
-                    {% if entry.field_id == 'gpgid' %}
-                        {% set size = "8" %}
-                    {% endif %}
-                    {% if entry.field_id == 'email_adh' %}
-                        {% set size = "30" %}
-                    {% endif %}
-                    {% if entry.field_id == 'fingerprint' %}
-                        {% set size = "40" %}
-                    {% endif %}
-                    {% if entry.field_id == 'bool_display_info' %}
-                        {% set title = _T("Do member want to appear publically?") %}
-                        {% set tip = _T("If you check this box (and if you are up to date with your contributions), your full name and other information will be publically visible on the members list.<br/>If you've uploaded a photo, it will be displayed on the trombinoscope page.<br/>Note that administrators can disabled public pages, this setting will have no effect in that case.") %}
-                        {% set checked = member.appearsInMembersList() %}
-                    {% endif %}
-                    {% if entry.field_id == 'login_adh' %}
-                        {% set example = _T("(at least %i characters)")|replace({"%i": 2}) %}
-                    {% endif %}
+                        {% if entry.field_id == 'gpgid' %}
+                            {% set size = "8" %}
+                        {% endif %}
+                        {% if entry.field_id == 'email_adh' %}
+                            {% set size = "30" %}
+                        {% endif %}
+                        {% if entry.field_id == 'fingerprint' %}
+                            {% set size = "40" %}
+                        {% endif %}
+                        {% if entry.field_id == 'bool_display_info' %}
+                            {% set title = _T("Do member want to appear publically?") %}
+                            {% set tip = _T("If you check this box (and if you are up to date with your contributions), your full name and other information will be publically visible on the members list.<br/>If you've uploaded a photo, it will be displayed on the trombinoscope page.<br/>Note that administrators can disabled public pages, this setting will have no effect in that case.") %}
+                            {% set checked = member.appearsInMembersList() %}
+                        {% endif %}
+                        {% if entry.field_id == 'login_adh' %}
+                            {% set example = _T("(at least %i characters)")|replace({"%i": 2}) %}
+                        {% endif %}
 
-                    {% if entry.field_id == 'bool_admin_adh' %}
-                        {% set checked = member.isAdmin() %}
-                    {% endif %}
-                    {% if entry.field_id == 'bool_exempt_adh' %}
-                        {% set checked = member.isDueFree() %}
-                    {% endif %}
-                    {% if entry.field_id == 'parent_id' %}
-                        {% set value = member.parent.id %}
-                    {% endif %}
-                    {% if entry.field_id == 'activite_adh' %}
-                        {% set value = member.isActive() %}
-                    {% endif %}
+                        {% if entry.field_id == 'bool_admin_adh' %}
+                            {% set checked = member.isAdmin() %}
+                        {% endif %}
+                        {% if entry.field_id == 'bool_exempt_adh' %}
+                            {% set checked = member.isDueFree() %}
+                        {% endif %}
+                        {% if entry.field_id == 'parent_id' %}
+                            {% set value = member.parent.id %}
+                        {% endif %}
+                        {% if entry.field_id == 'activite_adh' %}
+                            {% set value = member.isActive() %}
+                        {% endif %}
 
-                    {# If value has not been set, take the generic value #}
-                    {% if not value and propname != 'password' %}
-                        {% set value = attribute(member, propname) %}
-                    {% endif %}
+                        {# If value has not been set, take the generic value #}
+                        {% if not value and propname != 'password' %}
+                            {% set value = attribute(member, propname) %}
+                        {% endif %}
 
-                    {% include "components/forms/" ~ template with {
-                            name: entry.field_id,
-                            id: entry.field_id,
-                            value: value,
-                            required: entry.required,
-                            readonly: entry.readonly,
-                            disabled: entry.disabled,
-                            label: entry.label,
-                            title: title,
-                            size: size,
-                            tip: tip,
-                            compile_id: "input_" ~ entry.field_id,
-                            checked: checked ?? false,
-                            masschange: masschange ?? false
-                    } %}
-                    {% if loop.index0 % 3 == 2 or loop.last %}
+                        {% include "components/forms/" ~ template with {
+                                name: entry.field_id,
+                                id: entry.field_id,
+                                value: value,
+                                required: entry.required,
+                                readonly: entry.readonly,
+                                disabled: entry.disabled,
+                                label: entry.label,
+                                title: title,
+                                size: size,
+                                tip: tip,
+                                compile_id: "input_" ~ entry.field_id,
+                                checked: checked ?? false,
+                                masschange: masschange ?? false
+                        } %}
                         </div>
-                    {% endif %}
-                {% endfor %}
+                    {% endfor %}
+                    </div>
                 </div>
             </div>