From e62358253646f7cc244db660890118e969c84de3 Mon Sep 17 00:00:00 2001 From: Go MAEDA Date: Tue, 14 Dec 2021 01:24:13 +0000 Subject: Lazy load inline images (#36294). Patch by Mizuki ISHIKAWA. git-svn-id: http://svn.redmine.org/redmine/trunk@21313 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- app/helpers/application_helper.rb | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'app/helpers') diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index a798261bc..63f80f36a 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -320,7 +320,8 @@ module ApplicationHelper image_tag( thumbnail_path(attachment), :srcset => "#{thumbnail_path(attachment, :size => thumbnail_size * 2)} 2x", - :style => "max-width: #{thumbnail_size}px; max-height: #{thumbnail_size}px;" + :style => "max-width: #{thumbnail_size}px; max-height: #{thumbnail_size}px;", + :loading => "lazy" ), attachment_path( attachment @@ -946,7 +947,7 @@ module ApplicationHelper if !desc.blank? && alttext.blank? alt = " title=\"#{desc}\" alt=\"#{desc}\"" end - "src=\"#{image_url}\"#{alt}" + "src=\"#{image_url}\"#{alt} loading=\"lazy\"" else m end -- cgit v1.2.3