From 6a36cdc464decd91ad8b2e5c22ad693c58116a1e Mon Sep 17 00:00:00 2001 From: Arnaud Levy <contact@arnaudlevy.com> Date: Tue, 10 Oct 2023 15:10:51 +0200 Subject: [PATCH] refactor --- app/helpers/application_helper.rb | 4 ++++ app/views/admin/application/featured_image/_edit.html.erb | 2 +- .../communication/blocks/components/image/_edit.html.erb | 2 +- app/views/admin/communication/extranets/_form.html.erb | 2 +- 4 files changed, 7 insertions(+), 3 deletions(-) diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 0f7bd9455..9e38d801c 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -65,4 +65,8 @@ module ApplicationHelper Rails.application.config.default_images_formats.join(', ') end + def default_images_formats_accepted_hints + t('default_images_hint', formats: default_images_formats_accepted) + end + end diff --git a/app/views/admin/application/featured_image/_edit.html.erb b/app/views/admin/application/featured_image/_edit.html.erb index 2abb7b21d..36b5c002c 100644 --- a/app/views/admin/application/featured_image/_edit.html.erb +++ b/app/views/admin/application/featured_image/_edit.html.erb @@ -3,7 +3,7 @@ as: :single_deletable_file, direct_upload: true, label: false, - hint: t('default_images_hint', formats: default_images_formats_accepted), + hint: default_images_formats_accepted_hints, input_html: { accept: default_images_formats_accepted }, preview: true, resize: true %> diff --git a/app/views/admin/communication/blocks/components/image/_edit.html.erb b/app/views/admin/communication/blocks/components/image/_edit.html.erb index 1aa10f55f..eb69e2082 100644 --- a/app/views/admin/communication/blocks/components/image/_edit.html.erb +++ b/app/views/admin/communication/blocks/components/image/_edit.html.erb @@ -1,7 +1,7 @@ <% label = t('admin.communication.blocks.components.image.input.label') remove = t('admin.communication.blocks.components.image.input.remove') -hint = t('default_images_hint', formats: default_images_formats_accepted) +hint = default_images_formats_accepted_hints %> <div class="mb-3"> <div v-if="!<%= model %>.<%= property %>.id"> diff --git a/app/views/admin/communication/extranets/_form.html.erb b/app/views/admin/communication/extranets/_form.html.erb index a21c722cf..a01855258 100644 --- a/app/views/admin/communication/extranets/_form.html.erb +++ b/app/views/admin/communication/extranets/_form.html.erb @@ -15,7 +15,7 @@ <%= osuny_panel t('look_feel') do %> <%= f.input :logo, as: :single_deletable_file, - hint: t('default_images_hint', formats: default_images_formats_accepted), + hint: default_images_formats_accepted_hints, input_html: { accept: default_images_formats_accepted }, preview: 200, direct_upload: true %> -- GitLab