Use tag cloud objects in view

This allows us to not set the individual instance variables for the tag
cloud attributes.
This commit is contained in:
Katrina Owen 2013-02-28 22:00:23 -05:00
parent 61e04a8258
commit b5868d5c70
3 changed files with 11 additions and 19 deletions

View file

@ -3,12 +3,12 @@
<p><%= t('stats.tag_cloud_description') %></p>
<p>
<% if @tags_for_cloud.size < 1
<% if tag_cloud.tags.size < 1
t('stats.no_tags_available')
else
@tags_for_cloud.each do |t| %>
tag_cloud.tags.each do |t| %>
<%= link_to t.name, tag_path(t.name), {
:style => "font-size: " + (9 + 2*(t.count.to_i-@tags_min)/@tags_divisor).to_s + "pt",
:style => "font-size: " + (9 + 2*(t.count.to_i-tag_cloud.min)/tag_cloud.divisor).to_s + "pt",
:title => t.count.to_s+" #{t('common.actions_midsentence', :count => t.count)}"}
-%> <%
end
@ -20,15 +20,15 @@
<h3><%= t('stats.tag_cloud_90days_title') %></h3>
<p><%= t('stats.tag_cloud_90days_description') %></p>
<p>
<% if @tags_for_cloud_90days.size < 1
<% if tag_cloud_90days.tags.size < 1
t('stats.no_tags_available')
else
@tags_for_cloud_90days.each do |t| %>
tag_cloud_90days.tags.each do |t| %>
<%= link_to t.name, tag_path(t.name), {
:style => "font-size: " + (9 + 2*(t.count.to_i-@tags_min_90days)/@tags_divisor_90days).to_s + "pt",
:style => "font-size: " + (9 + 2*(t.count.to_i-tag_cloud_90days.min)/tag_cloud_90days.divisor).to_s + "pt",
:title => t.count.to_s+" #{t('common.actions_midsentence', :count => t.count)}"}
-%> <%
end
end-%>
</p>
</div>
</div>

View file

@ -15,7 +15,7 @@
<%= render :partial => 'projects' -%>
<h2><%= t('stats.tags') %></h2>
<%= render :partial => 'tags' -%>
<%= render :partial => 'tags', :locals => {:tag_cloud => @tag_cloud, :tag_cloud_90days => @tag_cloud_90days} -%>
<% else -%>
@ -23,4 +23,4 @@
<% end -%>
</div>
</div>