diff --git a/app/views/stats/_null_list_item.html.erb b/app/views/stats/_null_list_item.html.erb new file mode 100644 index 00000000..01dd52d8 --- /dev/null +++ b/app/views/stats/_null_list_item.html.erb @@ -0,0 +1,3 @@ +<% from.upto 10 do |i| -%> + <%= i -%> - <%=t('common.not_available_abbr')%> (<%=t('common.not_available_abbr')%>)
+<% end -%> diff --git a/app/views/stats/_projects.html.erb b/app/views/stats/_projects.html.erb index 51b61e98..c6bc5865 100755 --- a/app/views/stats/_projects.html.erb +++ b/app/views/stats/_projects.html.erb @@ -1,44 +1,23 @@

<%= t('stats.top10_projects') %>

- <% i=0 - @projects_and_actions.each do |p| - i+=1 -%> - <%= i -%> - <%= link_to p.name, {:controller => "projects", :action => "show", :id => p.id}%> (<%=p.count %> <%= t('common.actions_midsentence', :count => p.count) %>)
- <% end - if i < 10 - (i+1).upto 10 do |j| -%> - <%= j -%> - <%=t('common.not_available_abbr')%> (<%=t('common.not_available_abbr')%>)
- <% end - end - -%> + <% @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) %>)
+ <% end -%> + <%= render :partial => 'null_list_item', :locals => {:from => @projects_and_actions.size + 1} -%>

<%= t('stats.top10_projects_30days') %>

- <% i=0 - @projects_and_actions_last30days.each do |p| - i+=1 -%> - <%= i -%> - <%= link_to p.name, {:controller => "projects", :action => "show", :id => p.id} %> (<%=p.count %> <%= t('common.actions_midsentence', :count => p.count) %>)
- <% end - if i < 10 - (i+1).upto 10 do |j| -%> - <%= j -%> - <%=t('common.not_available_abbr')%> (<%=t('common.not_available_abbr')%>)
- <% end - end - -%> + <% @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) %>)
+ <% end -%> + <%= render :partial => 'null_list_item', :locals => {:from => @projects_and_actions_last30days.size + 1} -%>

<%= t('stats.top10_longrunning') %>

- <% i=0 - @projects_and_runtime.each do |p| - i+=1 -%> - <%= i -%> - <%= link_to p.name, {:controller => "projects", :action => "show", :id => p.id} %> (<%=p.age_in_days %> <%= t('common.days_midsentence', :count => p.age_in_days) %>)
- <% end - if i < 10 - (i+1).upto 10 do |j| -%> - <%= j -%> - <%=t('common.not_available_abbr')%> (<%=t('common.not_available_abbr')%>)
- <% end - end - -%> + <% @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) %>)
+ <% end -%> + <%= render :partial => 'null_list_item', :locals => {:from => @projects_and_runtime.size + 1} -%>