Project

General

Profile

Patch #37597 ยป generate-hires-thumbnails-only.patch

Go MAEDA, 2022-08-23 08:21

View differences:

app/helpers/application_helper.rb
def thumbnail_tag(attachment)
thumbnail_size = Setting.thumbnails_size.to_i
physical_thumbnail_size = thumbnail_size * 2
link_to(
image_tag(
thumbnail_path(attachment),
:srcset => "#{thumbnail_path(attachment, :size => thumbnail_size * 2)} 2x",
thumbnail_path(attachment, :size => physical_thumbnail_size),
:srcset => "#{thumbnail_path(attachment, :size => physical_thumbnail_size)} 2x",
:style => "max-width: #{thumbnail_size}px; max-height: #{thumbnail_size}px;",
:loading => "lazy"
),
test/helpers/application_helper_test.rb
assert_select_in(
thumbnail_tag(a),
'a[href=?][title=?] img[src=?][loading="lazy"]',
"/attachments/3", "logo.gif", "/attachments/thumbnail/3")
"/attachments/3", "logo.gif", "/attachments/thumbnail/3/200")
end
def test_link_to_project
    (1-1/1)