From d8121cb00b8bbd281d7362902590b110639bdeba Mon Sep 17 00:00:00 2001 From: GitLab Bot Date: Thu, 30 Jan 2020 18:08:57 +0000 Subject: Add latest changes from gitlab-org/gitlab@master --- .../layouts/nav/sidebar/_analytics_links.html.haml | 16 ++++++++++++++ app/views/layouts/nav/sidebar/_group.html.haml | 25 ++++++++++++++-------- app/views/layouts/nav/sidebar/_project.html.haml | 2 +- .../nav/sidebar/_project_analytics_link.html.haml | 16 -------------- 4 files changed, 33 insertions(+), 26 deletions(-) create mode 100644 app/views/layouts/nav/sidebar/_analytics_links.html.haml delete mode 100644 app/views/layouts/nav/sidebar/_project_analytics_link.html.haml (limited to 'app/views/layouts') diff --git a/app/views/layouts/nav/sidebar/_analytics_links.html.haml b/app/views/layouts/nav/sidebar/_analytics_links.html.haml new file mode 100644 index 00000000000..b859a1ade66 --- /dev/null +++ b/app/views/layouts/nav/sidebar/_analytics_links.html.haml @@ -0,0 +1,16 @@ +- navbar_links = links.sort_by(&:title) +- all_paths = navbar_links.map(&:path) + +- if navbar_links.any? + = nav_link(path: all_paths) do + = link_to navbar_links.first.link do + .nav-icon-container + = sprite_icon('chart') + %span.nav-item-name + = _('Analytics') + + %ul.sidebar-sub-level-items + - navbar_links.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 diff --git a/app/views/layouts/nav/sidebar/_group.html.haml b/app/views/layouts/nav/sidebar/_group.html.haml index 88bb0a97487..60c5ef3877f 100644 --- a/app/views/layouts/nav/sidebar/_group.html.haml +++ b/app/views/layouts/nav/sidebar/_group.html.haml @@ -1,3 +1,4 @@ +- should_display_analytics_pages_in_sidebar = Feature.enabled?(:analytics_pages_under_group_analytics_sidebar, @group) - issues_count = group_issues_count(state: 'opened') - merge_requests_count = group_merge_requests_count(state: 'opened') @@ -11,7 +12,9 @@ = @group.name %ul.sidebar-top-level-items.qa-group-sidebar - if group_sidebar_link?(:overview) - = nav_link(path: group_overview_nav_link_paths, html_options: { class: 'home' }) do + - paths = group_overview_nav_link_paths + - paths << 'contribution_analytics#show' unless should_display_analytics_pages_in_sidebar + = nav_link(path: paths, unless: -> { should_display_analytics_pages_in_sidebar && current_path?('groups/contribution_analytics#show') }, html_options: { class: 'home' }) do = link_to group_path(@group) do .nav-icon-container = sprite_icon('home') @@ -42,18 +45,19 @@ %span = _('Activity') - - if group_sidebar_link?(:contribution_analytics) - = nav_link(path: 'analytics#show') do - = link_to group_contribution_analytics_path(@group), title: _('Contribution Analytics'), data: { placement: 'right', qa_selector: 'contribution_analytics_link' } do - %span - = _('Contribution Analytics') + - unless should_display_analytics_pages_in_sidebar + - if group_sidebar_link?(:contribution_analytics) + = nav_link(path: 'contribution_analytics#show') do + = link_to group_contribution_analytics_path(@group), title: _('Contribution Analytics'), data: { placement: 'right', qa_selector: 'contribution_analytics_link' } do + %span + = _('Contribution Analytics') - = render_if_exists 'layouts/nav/group_insights_link' + = render_if_exists 'layouts/nav/group_insights_link' = render_if_exists "layouts/nav/ee/epic_link", group: @group - if group_sidebar_link?(:issues) - = nav_link(path: group_issues_sub_menu_items) do + = nav_link(path: group_issues_sub_menu_items, unless: -> { should_display_analytics_pages_in_sidebar && current_path?('issues_analytics#show') }) do = link_to issues_group_path(@group), data: { qa_selector: 'group_issues_item' } do .nav-icon-container = sprite_icon('issues') @@ -80,7 +84,8 @@ %span = boards_link_text - = render_if_exists 'layouts/nav/issues_analytics_link' + - unless should_display_analytics_pages_in_sidebar + = render_if_exists 'layouts/nav/issues_analytics_link' - if group_sidebar_link?(:labels) = nav_link(path: 'labels#index') do @@ -126,6 +131,8 @@ = render_if_exists 'groups/sidebar/packages' + = render 'layouts/nav/sidebar/analytics_links', links: group_analytics_navbar_links(@group, current_user) + - if group_sidebar_link?(:group_members) = nav_link(path: 'group_members#index') do = link_to group_group_members_path(@group) do diff --git a/app/views/layouts/nav/sidebar/_project.html.haml b/app/views/layouts/nav/sidebar/_project.html.haml index c2ac00e012a..f17981e501c 100644 --- a/app/views/layouts/nav/sidebar/_project.html.haml +++ b/app/views/layouts/nav/sidebar/_project.html.haml @@ -298,7 +298,7 @@ = render_if_exists 'layouts/nav/sidebar/project_packages_link' - = render 'layouts/nav/sidebar/project_analytics_link' + = render 'layouts/nav/sidebar/analytics_links', links: project_analytics_navbar_links(@project, current_user) - if project_nav_tab? :wiki - wiki_url = project_wiki_path(@project, :home) diff --git a/app/views/layouts/nav/sidebar/_project_analytics_link.html.haml b/app/views/layouts/nav/sidebar/_project_analytics_link.html.haml deleted file mode 100644 index 3eb8c024588..00000000000 --- a/app/views/layouts/nav/sidebar/_project_analytics_link.html.haml +++ /dev/null @@ -1,16 +0,0 @@ -- 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 -- cgit v1.2.1