From a023939350198cd077e3aab2f857e22922dd44ac Mon Sep 17 00:00:00 2001 From: Henriette Darge Date: Fri, 25 Sep 2026 08:21:39 +0200 Subject: [PATCH 1/2] Migrate the attachements setting form to primer --- .../attachments_settings/show.html.erb | 56 ++++++++++--------- 1 file changed, 30 insertions(+), 26 deletions(-) diff --git a/app/views/admin/settings/attachments_settings/show.html.erb b/app/views/admin/settings/attachments_settings/show.html.erb index cd248893fa6f..d051a68cfe95 100644 --- a/app/views/admin/settings/attachments_settings/show.html.erb +++ b/app/views/admin/settings/attachments_settings/show.html.erb @@ -36,30 +36,34 @@ See COPYRIGHT and LICENSE files for more details. ) %> -<%= styled_form_tag( - admin_settings_attachments_path, +<%= settings_primer_form_with( + url: admin_settings_attachments_path, + scope: :settings, method: :patch - ) do %> -
-
- <%= setting_check_box :show_work_package_attachments, container_class: "-slim" %> -
- <%= t("settings.attachments.show_work_package_attachments") %> -
-
-
- <%= setting_text_field :attachment_max_size, size: 6, unit: t(:"number.human.storage_units.units.kb"), container_class: "-slim" %> -
-
- <%= setting_text_area :attachment_whitelist, rows: 5, container_class: "-wide" %> -
- <%= t( - "settings.attachments.whitelist_text_html", - ext_example: "*.jpg", - mime_example: "image/jpeg" - ) %> -
-
-
- <%= styled_button_tag t(:button_save), class: "-primary -with-icon icon-checkmark" %> -<% end %> + ) do |f| + render_inline_settings_form(f) do |form| + form.check_box( + name: :show_work_package_attachments, + caption: t("settings.attachments.show_work_package_attachments") + ) + + form.text_field( + name: :attachment_max_size, + size: 6, + input_width: :xsmall, + trailing_visual: { text: { text: t(:"number.human.storage_units.units.kb") } } + ) + + form.text_area( + name: :attachment_whitelist, + caption: t( + "settings.attachments.whitelist_text_html", + ext_example: "*.jpg", + mime_example: "image/jpeg" + ), + rows: 5 + ) + + form.submit + end + end %> From 9fcb4f3a03fac149a54eaf58d0693f95f1299cca Mon Sep 17 00:00:00 2001 From: Henriette Darge Date: Wed, 30 Sep 2026 08:39:48 +0200 Subject: [PATCH 2/2] Add a caption for disabled attachment size field --- app/views/admin/settings/attachments_settings/show.html.erb | 3 ++- config/locales/en.yml | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/app/views/admin/settings/attachments_settings/show.html.erb b/app/views/admin/settings/attachments_settings/show.html.erb index d051a68cfe95..1df68f5822f5 100644 --- a/app/views/admin/settings/attachments_settings/show.html.erb +++ b/app/views/admin/settings/attachments_settings/show.html.erb @@ -51,7 +51,8 @@ See COPYRIGHT and LICENSE files for more details. name: :attachment_max_size, size: 6, input_width: :xsmall, - trailing_visual: { text: { text: t(:"number.human.storage_units.units.kb") } } + trailing_visual: { text: { text: t(:"number.human.storage_units.units.kb") } }, + caption: (t("settings.attachments.attachment_max_size_env_caption") if form.setting_disabled?(:attachment_max_size)) ) form.text_area( diff --git a/config/locales/en.yml b/config/locales/en.yml index 16ca8a6f81ec..311d88a9efa4 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -6138,6 +6138,7 @@ en: You are being redirected to the quarantine page. Use this page to delete or override quarantined files. title: "Virus scanning" attachments: + attachment_max_size_env_caption: "You can edit this value via environment variables if you have access." show_work_package_attachments: > Deactivating this option will hide the attachments list on the work packages files tab for new projects. The files attached in the description of a work package will still be uploaded in the internal attachments storage.