Skip to content
代码片段 群组 项目
提交 9506fcf7 编辑于 作者: Thomas Hutterer's avatar Thomas Hutterer 提交者: Max Woolf
浏览文件

Add "Activity" menu item to "Your work" sidebar

The new menu item links to the Activity dashboard.
上级 a343bd3e
No related branches found
No related tags found
无相关合并请求
# frozen_string_literal: true
module Sidebars
module YourWork
module Menus
class ActivityMenu < ::Sidebars::Menu
override :link
def link
activity_dashboard_path
end
override :title
def title
_('Activity')
end
override :sprite_icon
def sprite_icon
'history'
end
override :render?
def render?
!!context.current_user
end
override :active_routes
def active_routes
{ path: 'dashboard#activity' }
end
end
end
end
end
# frozen_string_literal: true
module Sidebars
module YourWork
module Menus
class MilestonesMenu < ::Sidebars::Menu
override :link
def link
dashboard_milestones_path
end
override :title
def title
_('Milestones')
end
override :sprite_icon
def sprite_icon
'clock'
end
override :render?
def render?
!!context.current_user
end
override :active_routes
def active_routes
{ controller: 'dashboard/milestones' }
end
end
end
end
end
...@@ -22,6 +22,8 @@ def render_raw_scope_menu_partial ...@@ -22,6 +22,8 @@ def render_raw_scope_menu_partial
def add_menus def add_menus
add_menu(Sidebars::YourWork::Menus::ProjectsMenu.new(context)) add_menu(Sidebars::YourWork::Menus::ProjectsMenu.new(context))
add_menu(Sidebars::YourWork::Menus::MilestonesMenu.new(context))
add_menu(Sidebars::YourWork::Menus::ActivityMenu.new(context))
end end
end end
end end
......
...@@ -9,6 +9,8 @@ ...@@ -9,6 +9,8 @@
sign_in(user) sign_in(user)
end end
it_behaves_like 'a dashboard page with sidebar', :activity_dashboard_path, :activity
context 'tabs' do context 'tabs' do
it 'shows Your Projects' do it 'shows Your Projects' do
visit activity_dashboard_path visit activity_dashboard_path
......
...@@ -26,6 +26,8 @@ ...@@ -26,6 +26,8 @@
visit dashboard_milestones_path visit dashboard_milestones_path
end end
it_behaves_like 'a dashboard page with sidebar', :dashboard_milestones_path, :milestones
it 'sees milestones' do it 'sees milestones' do
expect(page).to have_current_path dashboard_milestones_path, ignore_query: true expect(page).to have_current_path dashboard_milestones_path, ignore_query: true
expect(page).to have_content(milestone.title) expect(page).to have_content(milestone.title)
......
...@@ -232,6 +232,14 @@ ...@@ -232,6 +232,14 @@
{ {
nav_item: _("Projects"), nav_item: _("Projects"),
nav_sub_items: [] nav_sub_items: []
},
{
nav_item: _("Milestones"),
nav_sub_items: []
},
{
nav_item: _("Activity"),
nav_sub_items: []
} }
] ]
end end
......
0% 加载中 .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册