Skip to content

Commit 449604b

Browse files
committed
add lazy loading for avatars
1 parent 5d3c5ac commit 449604b

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

app/helpers/users_helper.rb

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@ def avatar_img(user)
88
class: "avatar",
99
alt: "",
1010
width: AvatarUploader::AVATAR_SIZE,
11-
height: AvatarUploader::AVATAR_SIZE
11+
height: AvatarUploader::AVATAR_SIZE,
12+
loading: "lazy"
1213
}
1314
image_tag(user.avatar_url, options)
1415
end
@@ -20,7 +21,8 @@ def mini_avatar_img(user)
2021
class: "avatar",
2122
alt: "",
2223
width: AvatarUploader::AVATAR_SIZE / 2,
23-
height: AvatarUploader::AVATAR_SIZE / 2
24+
height: AvatarUploader::AVATAR_SIZE / 2,
25+
loading: "lazy"
2426
}
2527
image_tag(user.avatar_url, options)
2628
end

0 commit comments

Comments
 (0)