mirror of
https://github.com/TracksApp/tracks.git
synced 2026-03-02 19:10:16 +01:00
Use `each_with_index` instead of hand-wrought index to loop through projects, and use a partial for the duplicated empty list items.
23 lines
1.3 KiB
Text
Executable file
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>
|