docbrown/app/views/notifications/_follow.html.erb

44 lines
2.1 KiB
Text

<% 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="small-pic-link-wrapper">
<div class="small-pic">
<img src="<%= first_notification["profile_image_90"] %>" alt="link to <%= first_notification["username"] %>'s profile">
</div>
</a>
<% end %>
<div class="content notification-content reaction-content">
<% if notification.json_data["aggregated_siblings"].length == 1 %>
<% cache "activity-follow-button-#{first_notification['path']}-#{first_notification['name']}" do %>
<a href="<%= first_notification["path"] %>"><%= first_notification["name"] %></a> followed you!
<%= follow_button(notification.decorate.mocked_object("user"), "follow-back") %>
<% end %>
<% elsif notification.json_data["aggregated_siblings"].length == 2 %>
<% json_data_array = notification["json_data"]["aggregated_siblings"] %>
<div class="follower-pic-row">
<div class="tiny-pic">
<a href="<%= json_data_array.last["path"] %>">
<img src="<%= json_data_array.last["profile_image_90"] %>" alt="link to <%= json_data_array.last["name"] %>'s profile" class="round">
</a>
</div>
</div>
<br>
<div class="notification-message">
<a href="<%= json_data_array.first["path"] %>"><%= json_data_array.first["name"] %></a> and
<a href="<%= json_data_array.second["path"] %>"><%= json_data_array.second["name"] %></a> followed you!
</div>
<% else %>
<div class="follower-pic-row">
<% notification.json_data["aggregated_siblings"][1..10].each do |sibling| %>
<div class="tiny-pic">
<a href="<%= sibling["path"] %>">
<img src="<%= sibling["profile_image_90"] %>" alt="link to <%= sibling["name"] %>'s profile" class="round">
</a>
</div>
<% end %>
</div>
<br>
<a href="<%= first_notification["path"] %>"><%= first_notification["name"] %></a>
and <%= notification.json_data["aggregated_siblings"].size - 1 %> others followed you!
<% end %>
</div>