From 276977287764960ede33212e28d1accbb506321c Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sat, 7 Mar 2026 11:47:34 +0000 Subject: [PATCH] Make form column layout configurable with global Twig variables Co-authored-by: jbtronics <5410681+jbtronics@users.noreply.github.com> --- config/packages/twig.yaml | 4 ++++ templates/admin/_delete_form.html.twig | 2 +- templates/admin/_export_form.html.twig | 2 +- templates/admin/base_admin.html.twig | 4 ++-- templates/admin/category_admin.html.twig | 6 +++--- templates/admin/footprint_admin.html.twig | 2 +- templates/admin/label_profile_admin.html.twig | 2 +- templates/admin/project_admin.html.twig | 4 ++-- templates/admin/storelocation_admin.html.twig | 2 +- templates/attachment_list.html.twig | 2 +- .../form/collection_types_layout.html.twig | 4 ++-- .../form/extended_bootstrap_layout.html.twig | 4 ++-- .../search/part_search.html.twig | 2 +- .../settings/provider_settings.html.twig | 4 ++-- templates/label_system/dialog.html.twig | 14 +++++++------- .../label_system/scanner/scanner.html.twig | 2 +- templates/log_system/log_list.html.twig | 2 +- templates/parts/edit/_eda.html.twig | 4 ++-- templates/parts/edit/_main.html.twig | 2 +- .../parts/edit/edit_form_styles.html.twig | 4 ++-- templates/parts/edit/edit_part_info.html.twig | 2 +- templates/parts/import/parts_import.html.twig | 2 +- .../parts/info/_stocktake_modal.html.twig | 16 ++++++++-------- templates/parts/info/_withdraw_modal.html.twig | 18 +++++++++--------- templates/parts/lists/_filter.html.twig | 2 +- templates/settings/settings.html.twig | 2 +- templates/users/_2fa_settings.html.twig | 18 +++++++++--------- templates/users/user_settings.html.twig | 2 +- 28 files changed, 69 insertions(+), 65 deletions(-) diff --git a/config/packages/twig.yaml b/config/packages/twig.yaml index 95ae4f3b..182f12ec 100644 --- a/config/packages/twig.yaml +++ b/config/packages/twig.yaml @@ -17,6 +17,10 @@ twig: available_themes: '%partdb.available_themes%' saml_enabled: '%partdb.saml.enabled%' part_preview_generator: '@App\Services\Attachments\PartPreviewGenerator' + # Bootstrap grid classes used for horizontal form layouts + form_label_col_class: 'col-sm-3 col-lg-2' + form_input_col_class: 'col-sm-9 col-lg-10' + form_offset_col_class: 'offset-sm-3 offset-lg-2' when@test: twig: diff --git a/templates/admin/_delete_form.html.twig b/templates/admin/_delete_form.html.twig index fd653256..86778f7a 100644 --- a/templates/admin/_delete_form.html.twig +++ b/templates/admin/_delete_form.html.twig @@ -5,7 +5,7 @@
-
+
{% set delete_disabled = (not is_granted("delete", entity)) or (entity.group is defined and entity.id == 1) or entity == app.user %}
diff --git a/templates/admin/_export_form.html.twig b/templates/admin/_export_form.html.twig index 07b00d43..20b4505e 100644 --- a/templates/admin/_export_form.html.twig +++ b/templates/admin/_export_form.html.twig @@ -35,7 +35,7 @@
-
+
diff --git a/templates/admin/base_admin.html.twig b/templates/admin/base_admin.html.twig index f710981d..b1298a50 100644 --- a/templates/admin/base_admin.html.twig +++ b/templates/admin/base_admin.html.twig @@ -129,7 +129,7 @@
-
+
{{ form_widget(form.save) }}
diff --git a/templates/form/collection_types_layout.html.twig b/templates/form/collection_types_layout.html.twig index 96b71bf0..d245df5c 100644 --- a/templates/form/collection_types_layout.html.twig +++ b/templates/form/collection_types_layout.html.twig @@ -63,8 +63,8 @@
{{ form_row(form.mountnames) }}
- -
+ +
{{ form_widget(form.price) }} {{ form_widget(form.priceCurrency) }} diff --git a/templates/form/extended_bootstrap_layout.html.twig b/templates/form/extended_bootstrap_layout.html.twig index 1227750c..bc16b437 100644 --- a/templates/form/extended_bootstrap_layout.html.twig +++ b/templates/form/extended_bootstrap_layout.html.twig @@ -17,11 +17,11 @@ {% block form_label_class -%} - col-sm-3 + {{ form_label_col_class }} {%- endblock form_label_class %} {% block form_group_class -%} - col-sm-9 + {{ form_input_col_class }} {%- endblock form_group_class %} {% block si_unit_widget %} diff --git a/templates/info_providers/search/part_search.html.twig b/templates/info_providers/search/part_search.html.twig index a5602618..0943716d 100644 --- a/templates/info_providers/search/part_search.html.twig +++ b/templates/info_providers/search/part_search.html.twig @@ -28,7 +28,7 @@ {{ form_row(form.providers) }}
- diff --git a/templates/info_providers/settings/provider_settings.html.twig b/templates/info_providers/settings/provider_settings.html.twig index 86e5bc9b..b5ba1bf9 100644 --- a/templates/info_providers/settings/provider_settings.html.twig +++ b/templates/info_providers/settings/provider_settings.html.twig @@ -8,7 +8,7 @@ {% block card_title %} {% trans %}info_providers.settings.title{% endtrans %}: {{ info_provider_info.name }}{% endblock %} {% block card_content %} -
+

{% if info_provider_info.url is defined %} {{ info_provider_info.name }} @@ -23,7 +23,7 @@ {{ form_start(form) }}
-
+
{{ form_help(form) }}
diff --git a/templates/label_system/dialog.html.twig b/templates/label_system/dialog.html.twig index 11877a4c..38c42960 100644 --- a/templates/label_system/dialog.html.twig +++ b/templates/label_system/dialog.html.twig @@ -36,7 +36,7 @@ {{ form_row(form.options.supported_element) }}
{{ form_label(form.options.width) }} -
+
{{ form_widget(form.options.width) }} @@ -59,8 +59,8 @@
- -
+ +
{{ profile.name ?? '-' }} {% if profile and is_granted("edit", profile) %}
-
+
diff --git a/templates/parts/edit/_eda.html.twig b/templates/parts/edit/_eda.html.twig index 1383871e..26bbf544 100644 --- a/templates/parts/edit/_eda.html.twig +++ b/templates/parts/edit/_eda.html.twig @@ -4,7 +4,7 @@ {{ form_row(form.eda_info.visibility) }}
-
+
{{ form_widget(form.eda_info.exclude_from_bom) }} {{ form_widget(form.eda_info.exclude_from_board) }} {{ form_widget(form.eda_info.exclude_from_sim) }} @@ -12,7 +12,7 @@
-
+
{% trans %}eda_info.kicad_section.title{% endtrans %}:
diff --git a/templates/parts/edit/_main.html.twig b/templates/parts/edit/_main.html.twig index f153d878..6a17bf30 100644 --- a/templates/parts/edit/_main.html.twig +++ b/templates/parts/edit/_main.html.twig @@ -1,7 +1,7 @@ {{ form_row(form.name) }} {% if part.category is not null and part.category.partnameHint is not empty %}
-
+

{% trans %}part.edit.name.category_hint{% endtrans %}: {{ part.category.partnameHint }}

diff --git a/templates/parts/edit/edit_form_styles.html.twig b/templates/parts/edit/edit_form_styles.html.twig index 9e989c92..8a1b7374 100644 --- a/templates/parts/edit/edit_form_styles.html.twig +++ b/templates/parts/edit/edit_form_styles.html.twig @@ -107,7 +107,7 @@ {% set id = 'collapse_' ~ random() %} -
@@ -142,7 +142,7 @@
{{ form_label(form.file) }} -
+
{{ form_widget(form.file) }} {{ form_errors(form.file) }} {% trans %}attachment.max_file_size{% endtrans %}: {{ max_upload_size | format_bytes }} diff --git a/templates/parts/edit/edit_part_info.html.twig b/templates/parts/edit/edit_part_info.html.twig index 28a88132..588e67da 100644 --- a/templates/parts/edit/edit_part_info.html.twig +++ b/templates/parts/edit/edit_part_info.html.twig @@ -140,7 +140,7 @@
-
+
{{ form_widget(form.save) }}
diff --git a/templates/settings/settings.html.twig b/templates/settings/settings.html.twig index 96e0f209..050f55fb 100644 --- a/templates/settings/settings.html.twig +++ b/templates/settings/settings.html.twig @@ -43,7 +43,7 @@ {{ (section_widget.vars.label ?? section_widget.vars.name|humanize)|trans }}
-
+
{{ form_help(section_widget) }} {{ form_errors(section_widget) }}
diff --git a/templates/users/_2fa_settings.html.twig b/templates/users/_2fa_settings.html.twig index 80392c17..0716b06d 100644 --- a/templates/users/_2fa_settings.html.twig +++ b/templates/users/_2fa_settings.html.twig @@ -37,11 +37,11 @@ {{ form_start(google_form, { 'attr': google_form_attr}) }} {% if not tfa_google.enabled %} -
+
{% trans %}tfa_google.disabled_message{% endtrans %}
-
+
{{ tfa_google.qrContent }}
@@ -55,7 +55,7 @@
-
+
@@ -72,7 +72,7 @@ {{ form_row(google_form.google_confirmation) }} {% else %} -
+
{% trans %}tfa_google.enabled_message{% endtrans %}
{% endif %} @@ -81,7 +81,7 @@
{% if user.backupCodes is empty %} -
+
{% trans %}tfa_backup.disabled{% endtrans %}
{% trans %}tfa_backup.explanation{% endtrans %}
@@ -89,19 +89,19 @@ {% set backup_form_attr = { 'data-delete-form': true, 'data-controller': 'elements--delete-btn', 'data-action': 'submit->elements--delete-btn#submit', 'data-delete-title': 'tfa_backup.reset_codes.confirm_title' | trans, 'data-delete-message': 'tfa_backup.reset_codes.confirm_message' | trans} %} {{ form_start(backup_form, { 'attr': backup_form_attr}) }} -
+
{% trans %}tfa_backup.enabled{% endtrans %}
{% trans %}tfa_backup.explanation{% endtrans %}
-
+

{% trans %}tfa_backup.remaining_tokens{% endtrans %}: {{ user.backupCodes | length }}

{% trans %}tfa_backup.generation_date{% endtrans %}: {{ user.backupCodesGenerationDate | format_datetime }}

-
+ -
+
{{ form_widget(backup_form.reset_codes) }}
{{ form_end(backup_form) }} diff --git a/templates/users/user_settings.html.twig b/templates/users/user_settings.html.twig index 0f218a1b..35f6f9d9 100644 --- a/templates/users/user_settings.html.twig +++ b/templates/users/user_settings.html.twig @@ -28,7 +28,7 @@ {{ form_row(settings_form.showEmailOnProfile) }} {{ form_row(settings_form.avatar_file) }}
-
+
{% if user.masterPictureAttachment %} avatar {% endif %}