Skip to content
Browse files

minor mod to top menu count, do not show count if none

  • Loading branch information...
1 parent 04f7abe commit 20f2c84552ca4254c0d8e7a3be6cbc8ffa540565 Brandon Farmer committed Dec 9, 2011
Showing with 5 additions and 3 deletions.
  1. +4 −2 init.rb
  2. +1 −1 lib/user_tasks_patch.rb
View
6 init.rb
@@ -15,6 +15,8 @@
description 'Allows you to maintain a personal todo list'
version '0.0.1'
- menu :top_menu, :todo_list, {:controller => 'tasks', :action => 'index'}, :caption => Proc.new {User.current.tasks_top_menu}, :if => Proc.new { User.current.logged? }
-
+ menu :top_menu, :todo_list,
+ {:controller => 'tasks', :action => 'index'},
+ :caption => Proc.new {User.current.tasks_top_menu},
+ :if => Proc.new { User.current.logged? }
end
View
2 lib/user_tasks_patch.rb
@@ -11,7 +11,7 @@ def self.included(base)
module InstanceMethods
def tasks_top_menu
- "Todo List (#{self.tasks.count})"
+ self.tasks.count > 0 ? "Todo List (#{self.tasks.count})" : "Todo List"
end
end
end

0 comments on commit 20f2c84

Please sign in to comment.
Something went wrong with that request. Please try again.