Tweak prefix image size for DisplayAds on articles (#18260)
This commit is contained in:
parent
bfbb472b19
commit
2d271706c3
1 changed files with 9 additions and 1 deletions
|
|
@ -7,6 +7,9 @@ class DisplayAd < ApplicationRecord
|
|||
"Sidebar Right",
|
||||
"Below the comment section"].freeze
|
||||
|
||||
POST_WIDTH = 775
|
||||
SIDEBAR_WIDTH = 350
|
||||
|
||||
belongs_to :organization, optional: true
|
||||
has_many :display_ad_events, dependent: :destroy
|
||||
|
||||
|
|
@ -41,6 +44,11 @@ class DisplayAd < ApplicationRecord
|
|||
tags: MarkdownProcessor::AllowedTags::DISPLAY_AD,
|
||||
attributes: MarkdownProcessor::AllowedAttributes::DISPLAY_AD
|
||||
html = stripped_html.delete("\n")
|
||||
self.processed_html = Html::Parser.new(html).prefix_all_images(350, synchronous_detail_detection: true).html
|
||||
self.processed_html = Html::Parser.new(html)
|
||||
.prefix_all_images(prefix_width, synchronous_detail_detection: true).html
|
||||
end
|
||||
|
||||
def prefix_width
|
||||
placement_area.to_s == "post_comments" ? POST_WIDTH : SIDEBAR_WIDTH
|
||||
end
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue