limit how many follows are shown

This commit is contained in:
Kyle Drake 2024-03-27 10:02:02 -05:00
parent f731466317
commit c090392b41

View file

@ -1,22 +1,26 @@
<% site_followings = site.followings_dataset.count %> <% site_followings_count = site.followings_dataset.count %>
<% if (!is_current_site && site_followings > 0) || is_current_site %> <% if (!is_current_site && site_followings_count > 0) || is_current_site %>
<div class="following-list"> <div class="following-list">
<h3><a href="/site/<%= site.username %>/follows"><%= is_current_site ? 'Sites you follow' : 'This site follows' %></a></h3> <h3><a href="/site/<%= site.username %>/follows"><%= is_current_site ? 'Sites you follow' : 'This site follows' %></a></h3>
<% if site_followings == 0 %> <% if site_followings_count == 0 %>
<p>You are not following any sites yet. Add some by <a href="/browse">browsing sites</a> or looking at your tags. <p>You are not following any sites yet. Add some by <a href="/browse">browsing sites</a> or looking at your tags.
<% else %> <% else %>
<% site.followings_dataset.select(:site_id).all.each do |following| %> <% site.followings_dataset.select(:site_id).limit(Site::MAX_DISPLAY_FOLLOWS).each do |following| %>
<a href="/site/<%= following.site_dataset.select(:username).first.username %>" title="<%= following.site.title %>"><img src="<%= following.site.screenshot_url 'index.html', '50x50' %>" class="avatar"></a> <a href="/site/<%= following.site_dataset.select(:username).first.username %>" title="<%= following.site.title %>"><img src="<%= following.site.screenshot_url 'index.html', '50x50' %>" class="avatar"></a>
<% end %> <% end %>
<% if Site::MAX_DISPLAY_FOLLOWS < site_followings_count %>
<a href="/site/<%= site.username %>/followers"><strong>see more <i class="fa fa-arrow-right"></i></strong></a>
<% end %>
<% end %> <% end %>
</div> </div>
<% end %> <% end %>
<% site_follows = site.follows_dataset.count %> <% site_follows_count = site.follows_dataset.count %>
<% if (!is_current_site && site_follows > 0) || is_current_site %> <% if (!is_current_site && site_follows_count > 0) || is_current_site %>
<div class="follower-list"> <div class="follower-list">
<h3><a href="/site/<%= site.username %>/followers">Followers</a></h3> <h3><a href="/site/<%= site.username %>/followers">Followers</a></h3>
<% if site_follows == 0 %> <% if site_follows_count == 0 %>
No followers yet. No followers yet.
<% else %> <% else %>
<% site_profile_follows_actioning_ids = site.profile_follows_actioning_ids %> <% site_profile_follows_actioning_ids = site.profile_follows_actioning_ids %>