Use file_field support for array to accept attribute (#37844)

This commit is contained in:
Matt Jankowski
2026-03-02 04:27:04 -05:00
committed by GitHub
parent e3a53b6f5a
commit c86a8f8798
4 changed files with 7 additions and 5 deletions

View File

@@ -85,6 +85,8 @@ class Form::AdminSettings
authorized_fetch: :authorized_fetch_mode?,
}.freeze
UPLOAD_MIME_TYPES = %w(image/jpeg image/png image/gif image/webp).freeze
DESCRIPTION_LIMIT = 200
DOMAIN_BLOCK_AUDIENCES = %w(disabled users all).freeze
REGISTRATION_MODES = %w(open approved none).freeze

View File

@@ -12,7 +12,7 @@
.fields-group
= f.input :image,
wrapper: :with_label,
input_html: { accept: CustomEmoji::IMAGE_MIME_TYPES.join(',') },
input_html: { accept: CustomEmoji::IMAGE_MIME_TYPES },
hint: t('admin.custom_emojis.image_hint', size: number_to_human_size(CustomEmoji::LIMIT))
.actions

View File

@@ -44,7 +44,7 @@
.fields-row__column.fields-row__column-6.fields-group
= f.input :favicon,
as: :file,
input_html: { accept: ['image/jpeg', 'image/png', 'image/gif', 'image/webp'].join(',') },
input_html: { accept: f.object.class::UPLOAD_MIME_TYPES },
wrapper: :with_block_label
.fields-row__column.fields-row__column-6.fields-group
@@ -58,7 +58,7 @@
.fields-row__column.fields-row__column-6.fields-group
= f.input :app_icon,
as: :file,
input_html: { accept: ['image/jpeg', 'image/png', 'image/gif', 'image/webp'].join(',') },
input_html: { accept: f.object.class::UPLOAD_MIME_TYPES },
wrapper: :with_block_label
.fields-row__column.fields-row__column-6.fields-group

View File

@@ -35,7 +35,7 @@
.fields-group
= f.input :avatar,
hint: t('simple_form.hints.defaults.avatar', dimensions: Account::Avatar::AVATAR_GEOMETRY, size: number_to_human_size(Account::Avatar::AVATAR_LIMIT)),
input_html: { accept: Account::Avatar::AVATAR_IMAGE_MIME_TYPES.join(',') },
input_html: { accept: Account::Avatar::AVATAR_IMAGE_MIME_TYPES },
wrapper: :with_block_label
.fields-row__column.fields-row__column-6
@@ -51,7 +51,7 @@
.fields-group
= f.input :header,
hint: t('simple_form.hints.defaults.header', dimensions: Account::Header::HEADER_GEOMETRY, size: number_to_human_size(Account::Header::HEADER_LIMIT)),
input_html: { accept: Account::Header::HEADER_IMAGE_MIME_TYPES.join(',') },
input_html: { accept: Account::Header::HEADER_IMAGE_MIME_TYPES },
wrapper: :with_block_label
.fields-row__column.fields-row__column-6