<% site_followings = site.followings %>
<% if (!is_current_site && !site_followings.empty?) || is_current_site %>
  <div class="following-list">
    <h3><%= is_current_site ? 'You follow' : 'This site follows' %></h3>
    <% if site_followings.empty? %>
      <p>You are not following any sites yet. Add some by <a href="/browse">browsing sites</a> or looking at your tags.
    <% else %>
      <% site.followings_dataset.select(:site_id).all.each do |following| %>
        <a href="/site/<%= following.site_dataset.select(:username).first.username %>"><img src="<%= following.site.screenshot_url 'index.html', '50x50' %>" class="avatar"></a>
      <% end %>
    <% end %>
  </div>
<% end %>

<% site_follows = site.follows %>
<% if (!is_current_site && !site_follows.empty?) || is_current_site %>
  <div class="follower-list">
    <h3>Followers</h3>
    <% if site_follows.empty? %>
      No followers yet.
    <% else %>
      <% site.follows_dataset.select(:actioning_site_id).all.each do |follow| %>
        <% follow_actioning_site = follow.actioning_site_dataset.select(:username).first %>
        <a href="/site/<%= follow_actioning_site.username %>"><img src="<%= follow_actioning_site.screenshot_url 'index.html', '50x50' %>" class="avatar"></a>
      <% end %>
    <% end %>
  </div>
<% end %>
