summaryrefslogtreecommitdiff
path: root/lib/sidebars/your_work/menus/todos_menu.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/sidebars/your_work/menus/todos_menu.rb')
-rw-r--r--lib/sidebars/your_work/menus/todos_menu.rb47
1 files changed, 47 insertions, 0 deletions
diff --git a/lib/sidebars/your_work/menus/todos_menu.rb b/lib/sidebars/your_work/menus/todos_menu.rb
new file mode 100644
index 00000000000..d37ffadb579
--- /dev/null
+++ b/lib/sidebars/your_work/menus/todos_menu.rb
@@ -0,0 +1,47 @@
+# frozen_string_literal: true
+
+module Sidebars
+ module YourWork
+ module Menus
+ class TodosMenu < ::Sidebars::Menu
+ include Gitlab::Utils::StrongMemoize
+
+ override :link
+ def link
+ dashboard_todos_path
+ end
+
+ override :title
+ def title
+ _('To-Do List')
+ end
+
+ override :sprite_icon
+ def sprite_icon
+ 'todo-done'
+ end
+
+ override :render?
+ def render?
+ !!context.current_user
+ end
+
+ override :active_routes
+ def active_routes
+ { path: 'dashboard/todos#index' }
+ end
+
+ override :has_pill?
+ def has_pill?
+ pill_count > 0
+ end
+
+ override :pill_count
+ def pill_count
+ context.current_user.todos_pending_count
+ end
+ strong_memoize_attr :pill_count
+ end
+ end
+ end
+end