diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-01-24 12:09:01 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-01-24 12:09:01 +0000 |
commit | 2c2dd5e36c4ed5f09f488be288882d98f9124d12 (patch) | |
tree | ad4c478bb1c588387a881b26a7db7c3237b9d4f3 /app/views/layouts/nav/sidebar | |
parent | 2ff184ad761fbfbe25a3d827c8f704349963a8d2 (diff) | |
download | gitlab-ce-2c2dd5e36c4ed5f09f488be288882d98f9124d12.tar.gz |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/views/layouts/nav/sidebar')
-rw-r--r-- | app/views/layouts/nav/sidebar/_project.html.haml | 47 | ||||
-rw-r--r-- | app/views/layouts/nav/sidebar/_project_analytics_link.html.haml | 16 |
2 files changed, 44 insertions, 19 deletions
diff --git a/app/views/layouts/nav/sidebar/_project.html.haml b/app/views/layouts/nav/sidebar/_project.html.haml index 3464cc1ea07..3096b2e43fe 100644 --- a/app/views/layouts/nav/sidebar/_project.html.haml +++ b/app/views/layouts/nav/sidebar/_project.html.haml @@ -1,3 +1,5 @@ +- should_display_analytics_pages_in_sidebar = Feature.enabled?(:analytics_pages_under_project_analytics_sidebar, @project) + .nav-sidebar{ class: ("sidebar-collapsed-desktop" if collapsed_sidebar?) } .nav-sidebar-inner-scroll - can_edit = can?(current_user, :admin_project, @project) @@ -8,7 +10,9 @@ .sidebar-context-title = @project.name %ul.sidebar-top-level-items - = nav_link(path: sidebar_projects_paths, html_options: { class: 'home' }) do + - paths = sidebar_projects_paths + - paths << 'cycle_analytics#show' unless should_display_analytics_pages_in_sidebar + = nav_link(path: paths, html_options: { class: 'home' }) do = link_to project_path(@project), class: 'shortcuts-project rspec-project-link', data: { qa_selector: 'project_link' } do .nav-icon-container = sprite_icon('home') @@ -34,15 +38,18 @@ = link_to project_releases_path(@project), title: _('Releases'), class: 'shortcuts-project-releases' do %span= _('Releases') - - if can?(current_user, :read_cycle_analytics, @project) - = nav_link(path: 'cycle_analytics#show') do - = link_to project_cycle_analytics_path(@project), title: _('Cycle Analytics'), class: 'shortcuts-project-cycle-analytics' do - %span= _('Cycle Analytics') - = render_if_exists 'layouts/nav/project_insights_link' + - unless should_display_analytics_pages_in_sidebar + - if can?(current_user, :read_cycle_analytics, @project) + = nav_link(path: 'cycle_analytics#show') do + = link_to project_cycle_analytics_path(@project), title: _('Cycle Analytics'), class: 'shortcuts-project-cycle-analytics' do + %span= _('Cycle Analytics') + + = render_if_exists 'layouts/nav/project_insights_link' + - if project_nav_tab? :files - = nav_link(controller: sidebar_repository_paths) do + = nav_link(controller: sidebar_repository_paths, unless: -> { should_display_analytics_pages_in_sidebar && current_path?('projects/graphs#charts') }) do = link_to project_tree_path(@project), class: 'shortcuts-tree qa-project-menu-repo' do .nav-icon-container = sprite_icon('doc-text') @@ -83,9 +90,10 @@ = link_to project_compare_index_path(@project, from: @repository.root_ref, to: current_ref) do = _('Compare') - = nav_link(path: 'graphs#charts') do - = link_to charts_project_graph_path(@project, current_ref) do - = _('Charts') + - unless should_display_analytics_pages_in_sidebar + = nav_link(path: 'graphs#charts') do + = link_to charts_project_graph_path(@project, current_ref) do + = _('Charts') = render_if_exists 'projects/sidebar/repository_locked_files' @@ -170,7 +178,7 @@ = number_with_delimiter(@project.open_merge_requests_count) - if project_nav_tab? :pipelines - = nav_link(controller: [:pipelines, :builds, :jobs, :pipeline_schedules, :artifacts]) do + = nav_link(controller: [:pipelines, :builds, :jobs, :pipeline_schedules, :artifacts], unless: -> { should_display_analytics_pages_in_sidebar && current_path?('projects/pipelines#charts') }) do = link_to project_pipelines_path(@project), class: 'shortcuts-pipelines qa-link-pipelines rspec-link-pipelines', data: { qa_selector: 'ci_cd_link' } do .nav-icon-container = sprite_icon('rocket') @@ -201,13 +209,13 @@ %span = _('Artifacts') - - if project_nav_tab? :pipelines + - if !should_display_analytics_pages_in_sidebar && project_nav_tab?(:pipelines) = nav_link(controller: :pipeline_schedules) do = link_to pipeline_schedules_path(@project), title: _('Schedules'), class: 'shortcuts-builds' do %span = _('Schedules') - - if @project.feature_available?(:builds, current_user) && !@project.empty_repo? + - if !should_display_analytics_pages_in_sidebar && @project.feature_available?(:builds, current_user) && !@project.empty_repo? = nav_link(path: 'pipelines#charts') do = link_to charts_project_pipelines_path(@project), title: _('Charts'), class: 'shortcuts-pipelines-charts' do %span @@ -290,7 +298,7 @@ = render_if_exists 'layouts/nav/sidebar/project_packages_link' - = render_if_exists 'layouts/nav/sidebar/project_analytics_link' # EE-specific + = render 'layouts/nav/sidebar/project_analytics_link' - if project_nav_tab? :wiki - wiki_url = project_wiki_path(@project, :home) @@ -410,11 +418,12 @@ = link_to project_network_path(@project, current_ref), title: _('Network'), class: 'shortcuts-network' do = _('Graph') - -# Shortcut to Repository > Charts (formerly, top-nav item "Graphs") - - unless @project.empty_repo? - %li.hidden - = link_to charts_project_graph_path(@project, current_ref), title: _('Charts'), class: 'shortcuts-repository-charts' do - = _('Charts') + - unless should_display_analytics_pages_in_sidebar + -# Shortcut to Repository > Charts (formerly, top-nav item "Graphs") + - unless @project.empty_repo? + %li.hidden + = link_to charts_project_graph_path(@project, current_ref), title: _('Charts'), class: 'shortcuts-repository-charts' do + = _('Charts') -# Shortcut to Issues > New Issue - if project_nav_tab?(:issues) diff --git a/app/views/layouts/nav/sidebar/_project_analytics_link.html.haml b/app/views/layouts/nav/sidebar/_project_analytics_link.html.haml new file mode 100644 index 00000000000..3eb8c024588 --- /dev/null +++ b/app/views/layouts/nav/sidebar/_project_analytics_link.html.haml @@ -0,0 +1,16 @@ +- navbar_sub_item = project_analytics_navbar_links(@project, current_user).sort_by(&:title) +- all_paths = navbar_sub_item.map(&:path) + +- if navbar_sub_item.any? + = nav_link(path: all_paths) do + = link_to navbar_sub_item.first.link, data: { qa_selector: 'project_analytics_link' } do + .nav-icon-container + = sprite_icon('chart') + %span.nav-item-name + = _('Analytics') + + %ul.sidebar-sub-level-items + - navbar_sub_item.each do |menu_item| + = nav_link(path: menu_item.path) do + = link_to(menu_item.link, menu_item.link_to_options) do + %span= menu_item.title |