tracks/app/views/stats/_projects.html.erb
Katrina Owen 254179b4c8 Simplify stats projects view
Use `each_with_index` instead of hand-wrought index to loop through
projects, and use a partial for the duplicated empty list items.
2013-03-02 00:38:54 -05:00

23 lines
1.3 KiB
Text
Executable file

<div class="stats_module">
<h3><%= t('stats.top10_projects') %></h3>
<% @projects_and_actions.each_with_index do |p, i| -%>
<%= i + 1 -%> - <%= link_to p.name, {:controller => "projects", :action => "show", :id => p.id}%> (<%=p.count %> <%= t('common.actions_midsentence', :count => p.count) %>) <br/>
<% end -%>
<%= render :partial => 'null_list_item', :locals => {:from => @projects_and_actions.size + 1} -%>
</div>
<div class="stats_module">
<h3><%= t('stats.top10_projects_30days') %></h3>
<% @projects_and_actions_last30days.each_with_index do |p, i| -%>
<%= i + 1 -%> - <%= link_to p.name, {:controller => "projects", :action => "show", :id => p.id} %> (<%=p.count %> <%= t('common.actions_midsentence', :count => p.count) %>) <br/>
<% end -%>
<%= render :partial => 'null_list_item', :locals => {:from => @projects_and_actions_last30days.size + 1} -%>
</div>
<div class="stats_module">
<h3><%= t('stats.top10_longrunning') %></h3>
<% @projects_and_runtime.each_with_index do |p, i| -%>
<%= i + 1 -%> - <%= link_to p.name, {:controller => "projects", :action => "show", :id => p.id} %> (<%=p.age_in_days %> <%= t('common.days_midsentence', :count => p.age_in_days) %>) <br/>
<% end -%>
<%= render :partial => 'null_list_item', :locals => {:from => @projects_and_runtime.size + 1} -%>
</div>