* Add loading=lazy to image tags * Fix test * Lazy-load some obvious templates * Lazy-load more verified templates
36 lines
2.6 KiB
Text
36 lines
2.6 KiB
Text
<div class="crayons-card notification <% if notification.json_data["aggregated_siblings"].length == 1 %> notification--middle <% else %> flex-col items-center <% end %>">
|
|
<% if notification.json_data["aggregated_siblings"].length == 1 %>
|
|
<% first_notification = notification.json_data["aggregated_siblings"].first %>
|
|
<% cache "activity-profile-pic-#{first_notification['id']}-#{first_notification['profile_image_90']}" do %>
|
|
<a href="<%= first_notification["path"] %>" class="crayons-avatar crayons-avatar--l <% if notification.json_data["aggregated_siblings"].length == 1 %>m:crayons-avatar--xl<% end %> shrink-0" tabindex="-1" aria-hidden="true">
|
|
<img src="<%= first_notification["profile_image_90"] %>" class="crayons-avatar__image" alt="link to <%= first_notification["username"] %>'s profile" width="48" height="48">
|
|
</a>
|
|
<% end %>
|
|
<div class="notification__content">
|
|
<% cache "activity-follow-button-#{first_notification['path']}-#{first_notification['name']}" do %>
|
|
<div class="flex justify-between items-center">
|
|
<p><a href="<%= first_notification["path"] %>" class="crayons-link fw-bold"><%= first_notification["name"] %></a> followed you!</p>
|
|
<%= follow_button(notification.decorate.mocked_object("user"), "follow-back") %>
|
|
</div>
|
|
<% end %>
|
|
</div>
|
|
<% else %>
|
|
<% json_data_array = notification["json_data"]["aggregated_siblings"] %>
|
|
<div class="flex mb-3 max-w-100 overflow-x-hidden">
|
|
<% notification.json_data["aggregated_siblings"][0..10].each do |sibling| %>
|
|
<a href="<%= sibling["path"] %>" class="crayons-avatar crayons-avatar--l shrink-0 mx-1" <% if sibling["id"] == json_data_array.first["id"] %> tabindex="-1" aria-hidden="true"<% end %>>
|
|
<img src="<%= sibling["profile_image_90"] %>" class="crayons-avatar__image" alt="link to <%= sibling["name"] %>'s profile" width="32" height="32" loading="lazy" />
|
|
</a>
|
|
<% end %>
|
|
</div>
|
|
<p>
|
|
<% if notification.json_data["aggregated_siblings"].length == 2 %>
|
|
<a href="<%= json_data_array.first["path"] %>" class="crayons-link fw-bold"><%= json_data_array.first["name"] %></a> and
|
|
<a href="<%= json_data_array.second["path"] %>" class="crayons-link fw-bold"><%= json_data_array.second["name"] %></a> followed you!
|
|
<% else %>
|
|
<a href="<%= json_data_array.first["path"] %>" class="crayons-link fw-bold"><%= json_data_array.first["name"] %></a>
|
|
and <%= notification.json_data["aggregated_siblings"].size - 1 %> others followed you!
|
|
<% end %>
|
|
</p>
|
|
<% end %>
|
|
</div>
|