aboutsummaryrefslogtreecommitdiffstats
path: root/app
diff options
context:
space:
mode:
Diffstat (limited to 'app')
-rw-r--r--app/decorators/controllers/refinery/pages_controller_decorator.rb17
1 files changed, 16 insertions, 1 deletions
diff --git a/app/decorators/controllers/refinery/pages_controller_decorator.rb b/app/decorators/controllers/refinery/pages_controller_decorator.rb
index d93ae9d..0d9a966 100644
--- a/app/decorators/controllers/refinery/pages_controller_decorator.rb
+++ b/app/decorators/controllers/refinery/pages_controller_decorator.rb
@@ -18,7 +18,8 @@ ApplicationController.class_eval do
# on every page.
#
find_all_blog_categories
- find_tags
+ #find_tags
+ calc_tags
end
def populate_home_page
@@ -28,4 +29,18 @@ ApplicationController.class_eval do
.where(:refinery_blog_categories => { :sidebar_position => 0 })
.page(params[:page])
end
+
+ def calc_tags
+ # Limit the number of tags to show:
+ # This should show the 50 most popular tags from the past 30 days.
+ # I think this is a fair compromise between most popular and recent.
+
+ opts = {
+ :order => 'count DESC',
+ :start_at => 30.days.ago,
+ :limit => 50
+ }
+
+ @tags = Refinery::Blog::Post.tag_counts_on(:tags, opts)
+ end
end