Allow defining alt text for server thumbnail (#38796)
This commit is contained in:
1 parent
be4ba1495c
commit
a217b633b7
5 files changed
+11
No files matched your search
@@ -22,6 +22,7 @@ class Form::AdminSettings
|
||||
custom_css
|
||||
profile_directory
|
||||
thumbnail
|
||||
thumbnail_description
|
||||
mascot
|
||||
trends
|
||||
trendable_by_default
|
||||
@@ -109,6 +110,7 @@ class Form::AdminSettings
|
||||
validates :media_cache_retention_period, :content_cache_retention_period, :backups_retention_period, numericality: { only_integer: true }, allow_blank: true, if: -> { defined?(@media_cache_retention_period) || defined?(@content_cache_retention_period) || defined?(@backups_retention_period) }
|
||||
validates :min_age, numericality: { only_integer: true }, allow_blank: true, if: -> { defined?(@min_age) }
|
||||
validates :site_short_description, length: { maximum: DESCRIPTION_LIMIT }, if: -> { defined?(@site_short_description) }
|
||||
validates :thumbnail_description, length: { maximum: DESCRIPTION_LIMIT }, if: -> { defined?(@thumbnail_description) }
|
||||
validates :status_page_url, url: true, allow_blank: true
|
||||
validate :validate_site_uploads
|
||||
validates :landing_page, inclusion: { in: LANDING_PAGE }, if: -> { defined?(@landing_page) }
|
||||
|
||||
@@ -26,6 +26,7 @@ class REST::InstanceSerializer < ActiveModel::Serializer
|
||||
'@1x': full_asset_url(object.thumbnail.file.url(:'@1x')),
|
||||
'@2x': full_asset_url(object.thumbnail.file.url(:'@2x')),
|
||||
},
|
||||
description: Setting.thumbnail_description,
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -33,6 +33,11 @@
|
||||
= f.input :thumbnail,
|
||||
as: :file,
|
||||
wrapper: :with_block_label
|
||||
- if @admin_settings.thumbnail.persisted?
|
||||
= f.input :thumbnail_description,
|
||||
as: :text,
|
||||
input_html: { rows: 2, maxlength: Form::AdminSettings::DESCRIPTION_LIMIT },
|
||||
wrapper: :with_block_label
|
||||
.fields-row__column.fields-row__column-6.fields-group
|
||||
- if @admin_settings.thumbnail.persisted?
|
||||
= image_tag @admin_settings.thumbnail.file.url(:'@1x'), class: 'fields-group__thumbnail'
|
||||
|
||||
Reference in new issue
Block a user