aboutsummaryrefslogtreecommitdiffstats
path: root/app
diff options
context:
space:
mode:
authorHarald Eilertsen <haraldei@anduin.net>2014-12-12 14:48:51 +0100
committerHarald Eilertsen <haraldei@anduin.net>2014-12-12 14:50:33 +0100
commit681bfd35a4914e86ec329dc682c0f4ea8379e689 (patch)
treea3d684ea369e3c915361db7b3a5c6638acabcd49 /app
parentb28eb64bce0be900f36abbbbb17a00ecc8c11df0 (diff)
downloadhmnoweb-681bfd35a4914e86ec329dc682c0f4ea8379e689.tar.gz
hmnoweb-681bfd35a4914e86ec329dc682c0f4ea8379e689.tar.bz2
hmnoweb-681bfd35a4914e86ec329dc682c0f4ea8379e689.zip
Limit the number of tags we show.
Display the 50 most popular tags from the past 30 days. This should be a fair compromise between most popular and most recent, I hope. We may have to tune this further, but it's at least better than showing all. This is a fix for issue #56.
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