Merge pull request #728 from Retrospring/feature/lazy

Use appropriate image sizes and lazy loading
This commit is contained in:
Karina Kwiatek 2022-10-11 22:36:20 +02:00 committed by GitHub
commit 59b619324c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
13 changed files with 15 additions and 15 deletions

View file

@ -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

View file

@ -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

View file

@ -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 }

View file

@ -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))

View file

@ -3,7 +3,7 @@
.media
- unless i.question.author_is_anonymous
%a.pull-left{ href: user_path(i.question.user) }
%img.answerbox__question-user-avatar.avatar-md{ src: i.question.user.profile_picture.url(:medium) }
%img.answerbox__question-user-avatar.avatar-md{ src: i.question.user.profile_picture.url(:small), loading: :lazy }
.media-body
%h6.text-muted.media-heading.answerbox__question-user
- if i.question.author_is_anonymous

View file

@ -1,6 +1,6 @@
.card.moderationbox{ data: { id: report.id } }
.card-header
%img.avatar-sm{ src: report.user.profile_picture.url(:medium) }
%img.avatar-sm{ src: report.user.profile_picture.url(:small), loading: :lazy }
= t(".reported_html",
user: user_screen_name(report.user),
content: report.type.sub("Reports::", ""),

View file

@ -3,9 +3,9 @@
%i.fa.fa-2x.fa-fw.fa-exclamation
.media-body
.notification__heading
%img.avatar-xs{ src: notification.target.user.profile_picture.url(:small) }
= t(".heading_html",
user: user_screen_name(notification.target.user),
%img.avatar-xs{ src: notification.target.user.profile_picture.url(:small), loading: :lazy }
= t(".heading_html",
user: user_screen_name(notification.target.user),
question: link_to(t(".link_text"), answer_path(username: notification.target.user.screen_name, id: notification.target.id)),
time: time_tooltip(notification.target))
.list-group

View file

@ -3,7 +3,7 @@
%i.fa.fa-2x.fa-fw.fa-comments
.media-body
.notification__heading
%img.avatar-xs{ src: notification.target.user.profile_picture.url(:small) }
%img.avatar-xs{ src: notification.target.user.profile_picture.url(:small), loading: :lazy }
- if notification.target.answer.user == current_user
= t(".heading_html",
user: user_screen_name(notification.target.user),

View file

@ -1,6 +1,6 @@
.media.notification
.notification__icon
%img.avatar-sm{ src: notification.target.source.profile_picture.url(:small) }
%img.avatar-sm{ src: notification.target.source.profile_picture.url(:small), loading: :lazy }
.media-body
%h6.media-heading.notification__user
= user_screen_name notification.target.source

View file

@ -3,7 +3,7 @@
%i.fa.fa-2x.fa-fw.fa-smile-o
.media-body
.notification__heading
%img.avatar-xs{ src: notification.target.user.profile_picture.url(:small) }
%img.avatar-xs{ src: notification.target.user.profile_picture.url(:small), loading: :lazy }
- if notification.target.parent_type == 'Answer'
= t(".heading_html",
user: user_screen_name(notification.target.user),

View file

@ -4,7 +4,7 @@
.media
- unless question.author_is_anonymous
%a.pull-left{ href: unless hidden then user_path(question.user) end }
%img.answerbox__question-user-avatar.avatar-md{ src: question.user.profile_picture.url(:medium) }
%img.answerbox__question-user-avatar.avatar-md{ src: question.user.profile_picture.url(:small) }
.media-body
- if user_signed_in?
.pull-right

View file

@ -5,7 +5,7 @@
- if type == 'discover'
.pull-left
%a{ href: user_screen_name(q.user, link_only: true) }
%img.avatar-md.mr-2{ src: q.user&.profile_picture&.url(:medium) }
%img.avatar-md.mr-2{ src: q.user&.profile_picture&.url(:small), loading: :lazy }
.media-body
- if user_signed_in?
.pull-right

View file

@ -2,7 +2,7 @@
.card.h-100.userbox
%img.userbox__header{ src: user.profile_header.url(:mobile) }
.card-body
%img.userbox__avatar{ src: user.profile_picture.url(:small) }
%img.userbox__avatar{ src: user.profile_picture.url(:small), loading: :lazy }
%a.profile__name{ href: user_path(user) }
- unless user.profile.display_name.blank?
.profile__display-name