tracks/app/views/stats/index.html.erb
Katrina Owen d5a555fbac Encapsulate dependencies of stats index page
This may be a bit extreme.

It's modeled after the ideal "rails way".

In the controller, we now know the name of a single resource. It
doesn't happen to be backed by a database table, but it does know all
about the task of collecting stats, leaving the controller concerned
with just munging params and rendering stuff.

I called the resource `IndexPage`, to avoid the temptation of trying to
reuse it, which can get pretty messy.

Later, if a better abstraction appears, it should be fairly painless to
alter.
2013-03-02 17:35:19 -07:00

27 lines
890 B
Text
Executable file

<div class="stats_content">
<h2><%= t('stats.totals') %></h2>
<%= render :partial => 'totals', :locals => {:totals => @stats.totals} -%>
<% unless current_user.todos.empty? -%>
<h2><%= t('stats.actions') %></h2>
<%= render :partial => 'actions', :locals => {:actions => @stats.actions} -%>
<h2><%= t('stats.contexts') %></h2>
<%= render :partial => 'contexts', :locals => {:contexts => @stats.contexts} -%>
<h2><%= t('stats.projects') %></h2>
<%= render :partial => 'projects', :locals => {:projects => @stats.projects} -%>
<h2><%= t('stats.tags') %></h2>
<%= render :partial => 'tags', :locals => {:tag_cloud => @stats.tag_cloud, :key => ''} -%>
<%= render :partial => 'tags', :locals => {:tag_cloud => @stats.tag_cloud_90days, :key => '_90days'} -%>
<% else -%>
<p><%= t('stats.more_stats_will_appear') %></p>
<% end -%>
</div>