diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-07-20 12:55:51 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-07-20 12:55:51 +0300 |
commit | e8d2c2579383897a1dd7f9debd359abe8ae8373d (patch) | |
tree | c42be41678c2586d49a75cabce89322082698334 /app/views/layouts/nav/sidebar | |
parent | fc845b37ec3a90aaa719975f607740c22ba6a113 (diff) |
Add latest changes from gitlab-org/gitlab@14-1-stable-eev14.1.0-rc42
Diffstat (limited to 'app/views/layouts/nav/sidebar')
6 files changed, 174 insertions, 240 deletions
diff --git a/app/views/layouts/nav/sidebar/_admin.html.haml b/app/views/layouts/nav/sidebar/_admin.html.haml index 21c3d7cb7e2..d0b73a3364a 100644 --- a/app/views/layouts/nav/sidebar/_admin.html.haml +++ b/app/views/layouts/nav/sidebar/_admin.html.haml @@ -1,12 +1,9 @@ -- avatar_size = sidebar_refactor_disabled? ? 24 : 18 -- avatar_size_class = sidebar_refactor_disabled? ? 's40' : 's32' - %aside.nav-sidebar.qa-admin-sidebar{ class: ("sidebar-collapsed-desktop" if collapsed_sidebar?), 'aria-label': _('Admin navigation') } .nav-sidebar-inner-scroll .context-header = link_to admin_root_path, title: _('Admin Overview') do - %span{ class: ['avatar-container', 'settings-avatar', 'rect-avatar', avatar_size_class] } - = sprite_icon('admin', size: avatar_size) + %span{ class: ['avatar-container', 'settings-avatar', 'rect-avatar', 's32'] } + = sprite_icon('admin', size: 18) %span.sidebar-context-title = _('Admin Area') %ul.sidebar-top-level-items{ data: { qa_selector: 'admin_sidebar_overview_submenu_content' } } @@ -209,19 +206,6 @@ = render_if_exists 'layouts/nav/sidebar/credentials_link' - - if show_service_templates_nav_link? - = nav_link(controller: :services) do - = link_to admin_application_settings_services_path do - .nav-icon-container - = sprite_icon('template') - %span.nav-item-name - = _('Service Templates') - %ul.sidebar-sub-level-items.is-fly-out-only - = nav_link(controller: :services, html_options: { class: "fly-out-top-item" } ) do - = link_to admin_application_settings_services_path do - %strong.fly-out-top-item-name - = _('Service Templates') - = nav_link(controller: :labels) do = link_to admin_labels_path do .nav-icon-container diff --git a/app/views/layouts/nav/sidebar/_analytics_links.html.haml b/app/views/layouts/nav/sidebar/_analytics_links.html.haml index 58989d6afc4..92a7b97203f 100644 --- a/app/views/layouts/nav/sidebar/_analytics_links.html.haml +++ b/app/views/layouts/nav/sidebar/_analytics_links.html.haml @@ -1,6 +1,6 @@ - navbar_links = links.sort_by(&:title) - all_paths = navbar_links.map(&:path) -- analytics_link = navbar_links.find { |link| link.title == _('Value Stream') } || navbar_links.first +- analytics_link = navbar_links.find { |link| link.title == _('Value stream') } || navbar_links.first - if navbar_links.any? = nav_link(path: all_paths) do diff --git a/app/views/layouts/nav/sidebar/_context_menu_body.html.haml b/app/views/layouts/nav/sidebar/_context_menu_body.html.haml deleted file mode 100644 index 321bcda5702..00000000000 --- a/app/views/layouts/nav/sidebar/_context_menu_body.html.haml +++ /dev/null @@ -1,9 +0,0 @@ -- avatar_size_class = sidebar_refactor_disabled? ? 's40' : 's32' -- avatar_classes = ['avatar-container', 'rect-avatar', 'group-avatar'] -- avatar_classes << avatar_size_class - -= link_to group_path(@group), title: @group.name, data: { qa_selector: 'group_scope_link' } do - %span{ class: avatar_classes } - = group_icon(@group, class: ['avatar', 'avatar-tile', avatar_size_class]) - %span.sidebar-context-title - = @group.name diff --git a/app/views/layouts/nav/sidebar/_group.html.haml b/app/views/layouts/nav/sidebar/_group.html.haml index 0ce1d48a2de..980730bc3be 100644 --- a/app/views/layouts/nav/sidebar/_group.html.haml +++ b/app/views/layouts/nav/sidebar/_group.html.haml @@ -1,207 +1,3 @@ -- issues_count = cached_issuables_count(@group, type: :issues) -- merge_requests_count = cached_issuables_count(@group, type: :merge_requests) -- aside_title = @group.subgroup? ? _('Subgroup navigation') : _('Group navigation') - -%aside.nav-sidebar{ class: ("sidebar-collapsed-desktop" if collapsed_sidebar?), **sidebar_tracking_attributes_by_object(@group), 'aria-label': aside_title } - .nav-sidebar-inner-scroll - - if sidebar_refactor_disabled? - .context-header - = render 'layouts/nav/sidebar/context_menu_body' - - %ul.sidebar-top-level-items.qa-group-sidebar - - if sidebar_refactor_enabled? - = nav_link(path: ['groups#show', 'groups#details'], html_options: { class: 'context-header' }) do - = render 'layouts/nav/sidebar/context_menu_body' - - = render_if_exists 'layouts/nav/sidebar/group_trial_status_widget', group: @group - - - if group_sidebar_link?(:overview) - - paths = group_overview_nav_link_paths - = nav_link(path: paths, unless: -> { current_path?('groups/contribution_analytics#show') }, html_options: { class: 'home' }) do - - information_link = sidebar_refactor_enabled? ? activity_group_path(@group) : group_path(@group) - = link_to information_link, class: 'has-sub-items', data: { qa_selector: 'group_information_link' } do - .nav-icon-container - - sprite = sidebar_refactor_enabled? ? 'group' : 'home' - = sprite_icon(sprite) - %span.nav-item-name - = group_information_title(@group) - - %ul.sidebar-sub-level-items{ data: { qa_selector: 'group_information_submenu'} } - = nav_link(path: paths, html_options: { class: "fly-out-top-item" } ) do - = link_to information_link do - %strong.fly-out-top-item-name - = group_information_title(@group) - %li.divider.fly-out-top-item - - - if sidebar_refactor_disabled? - = nav_link(path: ['groups#show', 'groups#details', 'groups#subgroups'], html_options: { class: 'home' }) do - = link_to details_group_path(@group), title: _('Group details') do - %span - = _('Details') - - - if group_sidebar_link?(:activity) - = nav_link(path: 'groups#activity') do - = link_to activity_group_path(@group), title: _('Activity') do - %span - = _('Activity') - - - if group_sidebar_link?(:labels) && sidebar_refactor_enabled? - = nav_link(path: 'labels#index') do - = link_to group_labels_path(@group), title: _('Labels') do - %span - = _('Labels') - - - if sidebar_refactor_enabled? - - if group_sidebar_link?(:group_members) - = nav_link(path: 'group_members#index') do - = link_to group_group_members_path(@group), title: _('Members'), data: { qa_selector: 'group_members_item' } do - %span - = _('Members') - - = render_if_exists "layouts/nav/ee/epic_link", group: @group - - - if group_sidebar_link?(:issues) - = nav_link(path: group_issues_sub_menu_items, unless: -> { current_path?('issues_analytics#show') }) do - = link_to issues_group_path(@group), data: { qa_selector: 'group_issues_item' }, class: 'has-sub-items' do - .nav-icon-container - = sprite_icon('issues') - %span.nav-item-name - = _('Issues') - %span.badge.badge-pill.count= issues_count - - %ul.sidebar-sub-level-items{ data: { qa_selector: 'group_issues_sidebar_submenu'} } - = nav_link(path: group_issues_sub_menu_items, html_options: { class: "fly-out-top-item" } ) do - = link_to issues_group_path(@group) do - %strong.fly-out-top-item-name - = _('Issues') - %span.badge.badge-pill.count.issue_counter.fly-out-badge= issues_count - - %li.divider.fly-out-top-item - = nav_link(path: 'groups#issues', html_options: { class: 'home' }) do - = link_to issues_group_path(@group), title: _('List') do - %span - = _('List') - - - if group_sidebar_link?(:boards) - = nav_link(path: ['boards#index', 'boards#show']) do - = link_to group_boards_path(@group), title: boards_link_text, data: { qa_selector: 'group_issue_boards_link' } do - %span - = boards_link_text - - - if group_sidebar_link?(:labels) && sidebar_refactor_disabled? - = nav_link(path: 'labels#index') do - = link_to group_labels_path(@group), title: _('Labels') do - %span - = _('Labels') - - - if group_sidebar_link?(:milestones) - = nav_link(path: 'milestones#index') do - = link_to group_milestones_path(@group), title: _('Milestones'), data: { qa_selector: 'group_milestones_link' } do - %span - = _('Milestones') - - = render_if_exists 'layouts/nav/sidebar/group_iterations_link' - - - if group_sidebar_link?(:merge_requests) - = nav_link(path: 'groups#merge_requests') do - = link_to merge_requests_group_path(@group) do - .nav-icon-container - = sprite_icon('git-merge') - %span.nav-item-name - = _('Merge requests') - %span.badge.badge-pill.count= merge_requests_count - %ul.sidebar-sub-level-items.is-fly-out-only - = nav_link(path: 'groups#merge_requests', html_options: { class: "fly-out-top-item" } ) do - = link_to merge_requests_group_path(@group) do - %strong.fly-out-top-item-name - = _('Merge requests') - %span.badge.badge-pill.count.merge_counter.js-merge-counter.fly-out-badge= merge_requests_count - - = render_if_exists "layouts/nav/ee/security_link" # EE-specific - - = render_if_exists "layouts/nav/ee/push_rules_link" # EE-specific - - - if group_sidebar_link?(:kubernetes) - = nav_link(controller: [:clusters]) do - = link_to group_clusters_path(@group) do - .nav-icon-container - = sprite_icon('cloud-gear') - %span.nav-item-name - = _('Kubernetes') - %ul.sidebar-sub-level-items.is-fly-out-only - = nav_link(controller: [:clusters], html_options: { class: "fly-out-top-item" } ) do - = link_to group_clusters_path(@group), title: _('Kubernetes'), class: 'shortcuts-kubernetes' do - %strong.fly-out-top-item-name - = _('Kubernetes') - - = render 'groups/sidebar/packages' - - = render 'layouts/nav/sidebar/analytics_links', links: group_analytics_navbar_links(@group, current_user) - - - if group_sidebar_link?(:wiki) - = render 'layouts/nav/sidebar/wiki_link', wiki_url: @group.wiki.web_url - - - if sidebar_refactor_disabled? - - if group_sidebar_link?(:group_members) - = nav_link(path: 'group_members#index') do - = link_to group_group_members_path(@group) do - .nav-icon-container - = sprite_icon('users') - %span.nav-item-name.qa-group-members-item - = _('Members') - %ul.sidebar-sub-level-items.is-fly-out-only - = nav_link(path: 'group_members#index', html_options: { class: "fly-out-top-item" } ) do - = link_to group_group_members_path(@group) do - %strong.fly-out-top-item-name - = _('Members') - - - if group_sidebar_link?(:settings) - = nav_link(path: group_settings_nav_link_paths) do - = link_to edit_group_path(@group), class: 'has-sub-items' do - .nav-icon-container - = sprite_icon('settings') - %span.nav-item-name{ data: { qa_selector: 'group_settings' } } - = _('Settings') - %ul.sidebar-sub-level-items.qa-group-sidebar-submenu{ data: { testid: 'group-settings-menu' } } - = nav_link(path: %w[groups#projects groups#edit badges#index ci_cd#show groups/applications#index], html_options: { class: "fly-out-top-item" } ) do - = link_to edit_group_path(@group) do - %strong.fly-out-top-item-name - = _('Settings') - %li.divider.fly-out-top-item - = nav_link(path: 'groups#edit') do - = link_to edit_group_path(@group), title: _('General'), data: { qa_selector: 'general_settings_link' } do - %span - = _('General') - - = nav_link(controller: :integrations) do - = link_to group_settings_integrations_path(@group), title: _('Integrations') do - %span - = _('Integrations') - - = nav_link(path: 'groups#projects') do - = link_to projects_group_path(@group), title: _('Projects') do - %span - = _('Projects') - - = nav_link(controller: :repository) do - = link_to group_settings_repository_path(@group), title: _('Repository') do - %span - = _('Repository') - - = nav_link(controller: [:ci_cd, 'groups/runners']) do - = link_to group_settings_ci_cd_path(@group), title: _('CI/CD') do - %span - = _('CI/CD') - - = nav_link(controller: :applications) do - = link_to group_settings_applications_path(@group), title: _('Applications') do - %span - = _('Applications') - - = render 'groups/sidebar/packages_settings' - - = render_if_exists "groups/ee/settings_nav" - - = render_if_exists "groups/ee/administration_nav" - - = render 'shared/sidebar_toggle_button' +-# We're migration the group sidebar to a logical model based structure. If you need to update +-# any of the existing menus, you can find them in app/views/layouts/nav/sidebar/_group_menus.html.haml. += render partial: 'shared/nav/sidebar', object: Sidebars::Groups::Panel.new(group_sidebar_context(@group, current_user)) diff --git a/app/views/layouts/nav/sidebar/_group_menus.html.haml b/app/views/layouts/nav/sidebar/_group_menus.html.haml new file mode 100644 index 00000000000..5738c8becd5 --- /dev/null +++ b/app/views/layouts/nav/sidebar/_group_menus.html.haml @@ -0,0 +1,166 @@ +- issues_count = cached_issuables_count(@group, type: :issues) +- merge_requests_count = cached_issuables_count(@group, type: :merge_requests) + += render_if_exists 'layouts/nav/sidebar/group_trial_status_widget', group: @group + +- if group_sidebar_link?(:overview) + - paths = group_overview_nav_link_paths + = nav_link(path: paths, unless: -> { current_path?('groups/contribution_analytics#show') }, html_options: { class: 'home' }) do + = link_to activity_group_path(@group), class: 'has-sub-items', data: { qa_selector: 'group_information_link' } do + .nav-icon-container + = sprite_icon('group') + %span.nav-item-name + = group_information_title(@group) + + %ul.sidebar-sub-level-items{ data: { qa_selector: 'group_information_submenu'} } + = nav_link(path: paths, html_options: { class: "fly-out-top-item" } ) do + = link_to activity_group_path(@group) do + %strong.fly-out-top-item-name + = group_information_title(@group) + %li.divider.fly-out-top-item + + - if group_sidebar_link?(:activity) + = nav_link(path: 'groups#activity') do + = link_to activity_group_path(@group), title: _('Activity') do + %span + = _('Activity') + + - if group_sidebar_link?(:labels) + = nav_link(path: 'labels#index') do + = link_to group_labels_path(@group), title: _('Labels') do + %span + = _('Labels') + + - if group_sidebar_link?(:group_members) + = nav_link(path: 'group_members#index') do + = link_to group_group_members_path(@group), title: _('Members'), data: { qa_selector: 'group_members_item' } do + %span + = _('Members') + += render_if_exists "layouts/nav/ee/epic_link", group: @group + +- if group_sidebar_link?(:issues) + = nav_link(path: group_issues_sub_menu_items, unless: -> { current_path?('issues_analytics#show') }) do + = link_to issues_group_path(@group), data: { qa_selector: 'group_issues_item' }, class: 'has-sub-items' do + .nav-icon-container + = sprite_icon('issues') + %span.nav-item-name + = _('Issues') + %span.badge.badge-pill.count= issues_count + + %ul.sidebar-sub-level-items{ data: { qa_selector: 'group_issues_sidebar_submenu'} } + = nav_link(path: group_issues_sub_menu_items, html_options: { class: "fly-out-top-item" } ) do + = link_to issues_group_path(@group) do + %strong.fly-out-top-item-name + = _('Issues') + %span.badge.badge-pill.count.issue_counter.fly-out-badge= issues_count + + %li.divider.fly-out-top-item + = nav_link(path: 'groups#issues', html_options: { class: 'home' }) do + = link_to issues_group_path(@group), title: _('List') do + %span + = _('List') + + - if group_sidebar_link?(:boards) + = nav_link(path: ['boards#index', 'boards#show']) do + = link_to group_boards_path(@group), title: boards_link_text, data: { qa_selector: 'group_issue_boards_link' } do + %span + = boards_link_text + + - if group_sidebar_link?(:milestones) + = nav_link(path: 'milestones#index') do + = link_to group_milestones_path(@group), title: _('Milestones'), data: { qa_selector: 'group_milestones_link' } do + %span + = _('Milestones') + + = render_if_exists 'layouts/nav/sidebar/group_iterations_link' + +- if group_sidebar_link?(:merge_requests) + = nav_link(path: 'groups#merge_requests') do + = link_to merge_requests_group_path(@group) do + .nav-icon-container + = sprite_icon('git-merge') + %span.nav-item-name + = _('Merge requests') + %span.badge.badge-pill.count= merge_requests_count + %ul.sidebar-sub-level-items.is-fly-out-only + = nav_link(path: 'groups#merge_requests', html_options: { class: "fly-out-top-item" } ) do + = link_to merge_requests_group_path(@group) do + %strong.fly-out-top-item-name + = _('Merge requests') + %span.badge.badge-pill.count.merge_counter.js-merge-counter.fly-out-badge= merge_requests_count + += render_if_exists "layouts/nav/ee/security_link" # EE-specific + += render_if_exists "layouts/nav/ee/push_rules_link" # EE-specific + +- if group_sidebar_link?(:kubernetes) + = nav_link(controller: [:clusters]) do + = link_to group_clusters_path(@group) do + .nav-icon-container + = sprite_icon('cloud-gear') + %span.nav-item-name + = _('Kubernetes') + %ul.sidebar-sub-level-items.is-fly-out-only + = nav_link(controller: [:clusters], html_options: { class: "fly-out-top-item" } ) do + = link_to group_clusters_path(@group), title: _('Kubernetes'), class: 'shortcuts-kubernetes' do + %strong.fly-out-top-item-name + = _('Kubernetes') + += render 'groups/sidebar/packages' + += render 'layouts/nav/sidebar/analytics_links', links: group_analytics_navbar_links(@group, current_user) + +- if group_sidebar_link?(:wiki) + = render 'layouts/nav/sidebar/wiki_link', wiki_url: @group.wiki.web_url + +- if group_sidebar_link?(:settings) + = nav_link(path: group_settings_nav_link_paths) do + = link_to edit_group_path(@group), class: 'has-sub-items' do + .nav-icon-container + = sprite_icon('settings') + %span.nav-item-name{ data: { qa_selector: 'group_settings' } } + = _('Settings') + %ul.sidebar-sub-level-items{ data: { testid: 'group-settings-menu', qa_selector: 'group_sidebar_submenu' } } + = nav_link(path: %w[groups#projects groups#edit badges#index ci_cd#show groups/applications#index], html_options: { class: "fly-out-top-item" } ) do + = link_to edit_group_path(@group) do + %strong.fly-out-top-item-name + = _('Settings') + %li.divider.fly-out-top-item + = nav_link(path: 'groups#edit') do + = link_to edit_group_path(@group), title: _('General'), data: { qa_selector: 'general_settings_link' } do + %span + = _('General') + + = nav_link(controller: :integrations) do + = link_to group_settings_integrations_path(@group), title: _('Integrations') do + %span + = _('Integrations') + + = nav_link(path: 'groups#projects') do + = link_to projects_group_path(@group), title: _('Projects') do + %span + = _('Projects') + + = nav_link(controller: :repository) do + = link_to group_settings_repository_path(@group), title: _('Repository') do + %span + = _('Repository') + + = nav_link(controller: [:ci_cd, 'groups/runners']) do + = link_to group_settings_ci_cd_path(@group), title: _('CI/CD') do + %span + = _('CI/CD') + + = nav_link(controller: :applications) do + = link_to group_settings_applications_path(@group), title: _('Applications') do + %span + = _('Applications') + + = render 'groups/sidebar/packages_settings' + + = render_if_exists "groups/ee/settings_nav" + += render_if_exists "groups/ee/administration_nav" + += render 'shared/sidebar_toggle_button' diff --git a/app/views/layouts/nav/sidebar/_profile.html.haml b/app/views/layouts/nav/sidebar/_profile.html.haml index daafabdb799..4db1e532ba5 100644 --- a/app/views/layouts/nav/sidebar/_profile.html.haml +++ b/app/views/layouts/nav/sidebar/_profile.html.haml @@ -1,12 +1,9 @@ -- avatar_size = sidebar_refactor_disabled? ? 40 : 32 -- avatar_size_class = sidebar_refactor_disabled? ? 's40' : 's32' - %aside.nav-sidebar{ class: ("sidebar-collapsed-desktop" if collapsed_sidebar?), **sidebar_tracking_attributes_by_object(current_user), 'aria-label': _('User settings') } .nav-sidebar-inner-scroll .context-header = link_to profile_path, title: _('Profile Settings') do - %span{ class: ['avatar-container', 'settings-avatar', avatar_size_class] } - = image_tag avatar_icon_for_user(current_user, avatar_size), class: ['avatar', 'avatar-tile', 'js-sidebar-user-avatar', avatar_size_class], alt: current_user.name, data: { testid: 'sidebar-user-avatar' } + %span{ class: ['avatar-container', 'settings-avatar', 's32'] } + = image_tag avatar_icon_for_user(current_user, 32), class: ['avatar', 'avatar-tile', 'js-sidebar-user-avatar', 's32'], alt: current_user.name, data: { testid: 'sidebar-user-avatar' } %span.sidebar-context-title= _('User Settings') %ul.sidebar-top-level-items = nav_link(path: 'profiles#show', html_options: {class: 'home'}) do |