From 31849db7f8d8b4cb72aa6b6b28bd5d75c35523d6 Mon Sep 17 00:00:00 2001 From: JoenioCosta Date: Wed, 21 May 2008 22:20:44 +0000 Subject: [PATCH] ActionItem252: only categories with more than X entries should show up in the top menu --- app/models/category.rb | 6 ++++++ app/views/profile_editor/index.rhtml | 2 -- app/views/shared/categories_menu.rhtml | 2 +- test/functional/application_controller_test.rb | 12 ++++++++++++ test/unit/category_test.rb | 12 ++++++++++++ 5 files changed, 31 insertions(+), 3 deletions(-) diff --git a/app/models/category.rb b/app/models/category.rb index 9f1c7be..5bd02b0 100644 --- a/app/models/category.rb +++ b/app/models/category.rb @@ -47,7 +47,13 @@ class Category < ActiveRecord::Base end def total_items + # FIXME this can be SLOW (??) articles.count + comments.count + enterprises.count + people.count + communities.count + products.count end + def display_in_menu? + # FIXME don't hardcode like this. Should be a setting of the environment, maybe + total_items >= 10 + end + end diff --git a/app/views/profile_editor/index.rhtml b/app/views/profile_editor/index.rhtml index 793a5c6..b331bd4 100644 --- a/app/views/profile_editor/index.rhtml +++ b/app/views/profile_editor/index.rhtml @@ -14,8 +14,6 @@ <%= file_manager_button(_('Manage Content'), 'icons-app/cms.png', :controller => 'cms') %> - <%= file_manager_button(_('My Interests'), 'icons-app/categories.png', :controller => 'profile_editor', :action => 'edit_categories') %> - <%= file_manager_button(_('Change Password'), 'icons-app/change-password.png', :controller => 'account', :action => 'change_password') if profile.person? %> <%= file_manager_button(_('Manage friends'), 'icons-app/friends.png', :controller => 'friends', :action => 'index') if profile.person? %> diff --git a/app/views/shared/categories_menu.rhtml b/app/views/shared/categories_menu.rhtml index 624975d..a79b10c 100644 --- a/app/views/shared/categories_menu.rhtml +++ b/app/views/shared/categories_menu.rhtml @@ -4,7 +4,7 @@
  • > <%= item.name %>