diff --git a/app/views/stats/_contexts.html.erb b/app/views/stats/_contexts.html.erb
index eb236a97..1bd8e419 100755
--- a/app/views/stats/_contexts.html.erb
+++ b/app/views/stats/_contexts.html.erb
@@ -4,34 +4,6 @@
-
-
<%= t('stats.top5_contexts') %>
-<%
- 1.upto 5 do |i|
- %><%=i-%> -
- <%= i <= @actions_per_context.size ?
- link_to(@actions_per_context[i-1]['name'], {:controller => "contexts", :action => "show", :id => @actions_per_context[i-1]['id']}) :
- t('common.not_available_abbr')%>
- (
- <%= i <= @actions_per_context.size ? @actions_per_context[i-1]['total'] : t('common.not_available_abbr')%>
- )
-
<%
- end
--%>
-
+<%= render :partial => 'contexts_list', :locals => {:contexts => @actions_per_context, :key => 'contexts'} -%>
-
-
<%= t('stats.top5_visible_contexts_with_incomplete_actions') %>
-<%
- 1.upto 5 do |i|
- %><%=i-%> -
- <%= i <= @running_actions_per_context.size ?
- link_to(@running_actions_per_context[i-1]['name'], {:controller => "contexts", :action => "show", :id => @running_actions_per_context[i-1]['id']}) :
- t('common.not_available_abbr')-%>
- (
- <%= i <= @running_actions_per_context.size ? @running_actions_per_context[i-1]['total'] : t('common.not_available_abbr')-%>
- )
-
<%
- end
--%>
-
+<%= render :partial => 'contexts_list', :locals => {:contexts => @running_actions_per_context, :key => 'visible_contexts_with_incomplete_actions'} -%>
diff --git a/app/views/stats/_contexts_list.html.erb b/app/views/stats/_contexts_list.html.erb
new file mode 100644
index 00000000..89c04d17
--- /dev/null
+++ b/app/views/stats/_contexts_list.html.erb
@@ -0,0 +1,7 @@
+
+
<%= t("stats.top5_#{key}") %>
+ <% contexts.each_with_index do |c, i| -%>
+ <%= i + 1 -%> - <%= link_to c.name, context_path(c) %> (<%=c.total%> <%= t('common.actions_midsentence', :count => c.total) %>)
+ <% end -%>
+ <%= render :partial => 'null_list_item', :locals => {:from => contexts.size + 1, :to => 5} -%>
+
diff --git a/app/views/stats/_null_list_item.html.erb b/app/views/stats/_null_list_item.html.erb
index 01dd52d8..b02cad2d 100644
--- a/app/views/stats/_null_list_item.html.erb
+++ b/app/views/stats/_null_list_item.html.erb
@@ -1,3 +1,3 @@
-<% from.upto 10 do |i| -%>
+<% from.upto(to) do |i| -%>
<%= i -%> - <%=t('common.not_available_abbr')%> (<%=t('common.not_available_abbr')%>)
<% end -%>
diff --git a/app/views/stats/_projects_list.html.erb b/app/views/stats/_projects_list.html.erb
index 475d01db..eddf1737 100644
--- a/app/views/stats/_projects_list.html.erb
+++ b/app/views/stats/_projects_list.html.erb
@@ -3,5 +3,5 @@
<% 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)) %>)
<% end -%>
- <%= render :partial => 'null_list_item', :locals => {:from => projects.size + 1} -%>
+ <%= render :partial => 'null_list_item', :locals => {:from => projects.size + 1, :to => 10} -%>