From 99b523bf9c8ae496cdcef23d3ebfcb5a41624b6f Mon Sep 17 00:00:00 2001 From: Andreas Nedbal Date: Mon, 10 Oct 2022 23:14:07 +0200 Subject: [PATCH] Use appropriate image sizes and lazy loading in answerbox --- app/views/answerbox/_comments.haml | 2 +- app/views/answerbox/_header.haml | 2 +- app/views/answerbox/_smiles.haml | 2 +- app/views/application/_answerbox.haml | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/app/views/answerbox/_comments.haml b/app/views/answerbox/_comments.haml index e7b206eb..8f81335a 100644 --- a/app/views/answerbox/_comments.haml +++ b/app/views/answerbox/_comments.haml @@ -8,7 +8,7 @@ .media .pull-left %a{ href: user_path(comment.user) } - %img.comment__user-avatar.avatar-sm{ src: comment.user.profile_picture.url(:medium) } + %img.comment__user-avatar.avatar-sm{ src: comment.user.profile_picture.url(:small), loading: :lazy } .media-body %h6.media-heading.comment__user = user_screen_name comment.user diff --git a/app/views/answerbox/_header.haml b/app/views/answerbox/_header.haml index f1198128..588bc821 100644 --- a/app/views/answerbox/_header.haml +++ b/app/views/answerbox/_header.haml @@ -2,7 +2,7 @@ .media - unless a.question.author_is_anonymous %a.pull-left{ href: user_path(a.question.user) } - %img.answerbox__question-user-avatar.avatar-md{ src: a.question.user.profile_picture.url(:medium) } + %img.answerbox__question-user-avatar.avatar-md{ src: a.question.user.profile_picture.url(:small), loading: :lazy } .media-body - if user_signed_in? .pull-right diff --git a/app/views/answerbox/_smiles.haml b/app/views/answerbox/_smiles.haml index 8abf967d..371fe111 100644 --- a/app/views/answerbox/_smiles.haml +++ b/app/views/answerbox/_smiles.haml @@ -9,4 +9,4 @@ %a{ href: user_path(smile.user), title: user_screen_name(smile.user, url: false), data: { toggle: :tooltip, placement: :top, smile_id: smile.id } } - %img.avatar-xs{ src: smile.user.profile_picture.url(:medium) } + %img.avatar-xs{ src: smile.user.profile_picture.url(:small), loading: :lazy } diff --git a/app/views/application/_answerbox.haml b/app/views/application/_answerbox.haml index 51f1fa41..4be146ed 100644 --- a/app/views/application/_answerbox.haml +++ b/app/views/application/_answerbox.haml @@ -19,7 +19,7 @@ .media .pull-left %a{ href: user_path(a.user) } - %img.answerbox__answer-user-avatar.avatar-sm{ src: a.user.profile_picture.url(:medium) } + %img.answerbox__answer-user-avatar.avatar-sm{ src: a.user.profile_picture.url(:small), loading: :lazy } .media-body %h6.media-heading.answerbox__answer-user = raw t(".answered", hide: hidespan(t(".hide"), "d-none d-sm-inline"), user: user_screen_name(a.user))