mirror of
https://github.com/TracksApp/tracks.git
synced 2025-12-24 11:10:12 +01:00
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:
parent
61e04a8258
commit
b5868d5c70
3 changed files with 11 additions and 19 deletions
|
|
@ -552,16 +552,8 @@ class StatsController < ApplicationController
|
|||
end
|
||||
|
||||
def get_stats_tags
|
||||
cloud = Stats::TagCloud.new(current_user)
|
||||
|
||||
@tags_for_cloud = cloud.tags
|
||||
@tags_min = cloud.min
|
||||
@tags_divisor = cloud.divisor
|
||||
|
||||
cloud = Stats::TagCloud.new(current_user, @cut_off_3months)
|
||||
@tags_for_cloud_90days = cloud.tags
|
||||
@tags_min_90days = cloud.min
|
||||
@tags_divisor_90days = cloud.divisor
|
||||
@tag_cloud = Stats::TagCloud.new(current_user)
|
||||
@tag_cloud_90days = Stats::TagCloud.new(current_user, @cut_off_3months)
|
||||
end
|
||||
|
||||
def get_ids_from (actions, week_from, week_to, at_end)
|
||||
|
|
|
|||
|
|
@ -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>
|
||||
|
|
|
|||
|
|
@ -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>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue