Move default embed size knowledge into OEmbedSerializer
(#31990)
Co-authored-by: Claire <claire.github-309c@sitedethib.com>
This commit is contained in:
parent
8afa3bb2fa
commit
bdf83c353f
3 changed files with 6 additions and 12 deletions
|
@ -8,6 +8,8 @@ class OEmbedSerializer < ActiveModel::Serializer
|
|||
div1: 'font-weight: 500;',
|
||||
}.freeze
|
||||
|
||||
DEFAULT_WIDTH = 400
|
||||
|
||||
include RoutingHelper
|
||||
include ActionView::Helpers::TagHelper
|
||||
|
||||
|
@ -57,10 +59,10 @@ class OEmbedSerializer < ActiveModel::Serializer
|
|||
end
|
||||
|
||||
def width
|
||||
instance_options[:width]
|
||||
(instance_options[:width] || DEFAULT_WIDTH).to_i
|
||||
end
|
||||
|
||||
def height
|
||||
instance_options[:height]
|
||||
instance_options[:height].presence&.to_i
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue