app/views/users/contributors.html.erb
<div class="container-fluid">
<h2>Contributors (<%= User.count %>)</h2>
<p>
<% if params[:action] == "contributors" %>
<span style="color:grey;">All</span> |
<a href="/contributors/top">Most prolific</a>
<% else %>
<a href="/contributors">All</a> |
<span style="color:grey;">Most active</span>
<% end %>
</p>
<table class="table">
<tr>
<th>Most recent spectrum</th>
<th>Name</th>
<th></th>
<th>Comments</th>
<th>Activity</th>
</tr>
<% @users.each do |user| %>
<tr>
<td><% if user.spectrum_count.positive? %><img width="120px" class="img" src="<%= user.spectrums.order('id DESC').limit(1).last.photo.url(:thumb) %>" /><% end %></td>
<td><a href="/profile/<%= user.login %>"><%= user.login %></a>
| <a href="http://publiclab.org/profile/<%= user.login %>">Public Lab profile</a></td>
<td><%= user.spectrum_count %> spectra</td>
<td><%= user.comments.length %> comments</td>
<td><% if user.spectrum_count.positive? %>Last uploaded <%= time_ago_in_words(user.spectrums.order('id DESC').limit(1).last.created_at) %> ago<% end %></td>
</tr>
<% end %>
</table>
<%= will_paginate @users, renderer: BootstrapPagination::Rails %>
</div>