Collapse duplication in stats project view

This commit is contained in:
Katrina Owen 2013-03-02 00:48:59 -05:00
parent 254179b4c8
commit a41704b72f
2 changed files with 11 additions and 21 deletions

View file

@ -1,23 +1,6 @@
<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>
<%= render :partial => 'projects_list', :locals => {:projects => @projects_and_actions, :key => 'projects', :n => :count} -%>
<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>
<%= render :partial => 'projects_list', :locals => {:projects => @projects_and_actions_last30days, :key => 'projects_30days', :n => :count} -%>
<%= render :partial => 'projects_list', :locals => {:projects => @projects_and_runtime, :key => 'longrunning', :n => :age_in_days} -%>
<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>

View file

@ -0,0 +1,7 @@
<div class="stats_module">
<h3><%= t("stats.top10_#{key}") %></h3>
<% projects.each_with_index do |p, i| -%>
<%= i + 1 -%> - <%= link_to p.name, project_path(p) %> (<%=p.send(n)%> <%= t('common.actions_midsentence', :count => p.send(n)) %>) <br/>
<% end -%>
<%= render :partial => 'null_list_item', :locals => {:from => projects.size + 1} -%>
</div>