Simplify context partial in stats

This commit is contained in:
Katrina Owen 2013-03-02 09:54:46 -05:00
parent 6c3f447d8e
commit 2d2e5fd133
4 changed files with 11 additions and 32 deletions

View file

@ -4,34 +4,6 @@
<br style="clear:both">
<div class="stats_module">
<h3><%= t('stats.top5_contexts') %></h3>
<%
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')%>
)
<br/><%
end
-%>
</div>
<%= render :partial => 'contexts_list', :locals => {:contexts => @actions_per_context, :key => 'contexts'} -%>
<div class="stats_module">
<h3><%= t('stats.top5_visible_contexts_with_incomplete_actions') %></h3>
<%
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')-%>
)
<br/><%
end
-%>
</div>
<%= render :partial => 'contexts_list', :locals => {:contexts => @running_actions_per_context, :key => 'visible_contexts_with_incomplete_actions'} -%>

View file

@ -0,0 +1,7 @@
<div class="stats_module">
<h3><%= t("stats.top5_#{key}") %></h3>
<% 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) %>) <br/>
<% end -%>
<%= render :partial => 'null_list_item', :locals => {:from => contexts.size + 1, :to => 5} -%>
</div>

View file

@ -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')%>) <br/>
<% end -%>

View file

@ -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)) %>) <br/>
<% end -%>
<%= render :partial => 'null_list_item', :locals => {:from => projects.size + 1} -%>
<%= render :partial => 'null_list_item', :locals => {:from => projects.size + 1, :to => 10} -%>
</div>