summaryrefslogtreecommitdiff
path: root/app/views/layouts/header/_default.html.haml
blob: 8aba9426ec05b03b3ca74b3a2ae73f8d29d856c2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
- has_impersonation_link = header_link?(:admin_impersonation)
- user_status_data = user_status_properties(current_user)

%header.navbar.navbar-gitlab.navbar-expand-sm.js-navbar{ data: { qa_selector: 'navbar' } }
  %a.sr-only.gl-accessibility{ href: "#content-body", tabindex: "1" } Skip to content
  .container-fluid
    .header-content
      .title-container
        %h1.title
          %span.gl-sr-only GitLab
          = link_to root_path, title: _('Dashboard'), id: 'logo', **tracking_attrs('main_navigation', 'click_gitlab_logo_link', 'navigation') do
            = brand_header_logo
            - logo_text = brand_header_logo_type
            - if logo_text.present?
              %span.logo-text.d-none.d-lg-block.gl-ml-3
                = logo_text
          - if Gitlab.com_and_canary?
            = link_to 'https://next.gitlab.com', class: 'canary-badge bg-transparent', target: :_blank do
              %span.color-label.has-tooltip.badge.badge-pill.green-badge
                = _('Next')

        - if current_user
          = render "layouts/nav/dashboard"
        - else
          = render "layouts/nav/explore"

      .navbar-collapse.collapse
        %ul.nav.navbar-nav
          - if current_user
            = render 'layouts/header/new_dropdown'
          - if header_link?(:search)
            %li.nav-item.d-none.d-lg-block.m-auto
              = render 'layouts/search' unless current_controller?(:search)
            %li.nav-item.d-inline-block.d-lg-none
              = link_to search_context.search_url, title: _('Search'), aria: { label: _('Search') }, data: {toggle: 'tooltip', placement: 'bottom', container: 'body'} do
                = sprite_icon('search')
          - if header_link?(:issues)
            = nav_link(path: 'dashboard#issues', html_options: { class: "user-counter" }) do
              = link_to assigned_issues_dashboard_path, title: _('Issues'), class: 'dashboard-shortcuts-issues', aria: { label: _('Issues') },
                data: { qa_selector: 'issues_shortcut_button', toggle: 'tooltip', placement: 'bottom',
                track_label: 'main_navigation',
                track_event: 'click_issues_link',
                track_property: 'navigation',
                container: 'body' } do
                = sprite_icon('issues')
                - issues_count = assigned_issuables_count(:issues)
                %span.badge.badge-pill.issues-count.green-badge{ class: ('hidden' if issues_count == 0) }
                  = number_with_delimiter(issues_count)
          - if header_link?(:merge_requests)
            = nav_link(path: 'dashboard#merge_requests', html_options: { class: "user-counter" }) do
              = link_to assigned_mrs_dashboard_path, title: _('Merge requests'), class: 'dashboard-shortcuts-merge_requests', aria: { label: _('Merge requests') },
                data: { qa_selector: 'merge_requests_shortcut_button', toggle: 'tooltip', placement: 'bottom',
                track_label: 'main_navigation',
                track_event: 'click_merge_link',
                track_property: 'navigation',
                container: 'body' } do
                = sprite_icon('git-merge')
                - merge_requests_count = assigned_issuables_count(:merge_requests)
                %span.badge.badge-pill.merge-requests-count{ class: ('hidden' if merge_requests_count == 0) }
                  = number_with_delimiter(merge_requests_count)
          - if header_link?(:todos)
            = nav_link(controller: 'dashboard/todos', html_options: { class: "user-counter" }) do
              = link_to dashboard_todos_path, title: _('To-Do List'), aria: { label: _('To-Do List') }, class: 'shortcuts-todos',
                data: { qa_selector: 'todos_shortcut_button', toggle: 'tooltip', placement: 'bottom',
                track_label: 'main_navigation',
                track_event: 'click_to_do_link',
                track_property: 'navigation',
                container: 'body' } do
                = sprite_icon('todo-done')
                %span.badge.badge-pill.todos-count.js-todos-count{ class: ('hidden' if todos_pending_count == 0) }
                  = todos_count_format(todos_pending_count)
          %li.nav-item.header-help.dropdown.d-none.d-md-block{ **tracking_attrs('main_navigation', 'click_question_mark_link', 'navigation') }
            = link_to help_path, class: 'header-help-dropdown-toggle', data: { toggle: "dropdown" } do
              %span.gl-sr-only
                = s_('Nav|Help')
              = sprite_icon('question')
              %span.notification-dot.rounded-circle.gl-absolute
              = sprite_icon('chevron-down', css_class: 'caret-down')
            .dropdown-menu.dropdown-menu-right
              = render 'layouts/header/help_dropdown'
          - if header_link?(:user_dropdown)
            %li.nav-item.header-user.js-nav-user-dropdown.dropdown{ data: { track_label: "profile_dropdown", track_event: "click_dropdown", track_value: "", qa_selector: 'user_menu' }, class: ('mr-0' if has_impersonation_link) }
              = link_to current_user, class: user_dropdown_class, data: { toggle: "dropdown" } do
                = image_tag avatar_icon_for_user(current_user, 23), width: 23, height: 23, class: "header-user-avatar qa-user-avatar", alt: current_user.name
                = render_if_exists 'layouts/header/user_notification_dot', project: project, namespace: group
                = sprite_icon('chevron-down', css_class: 'caret-down')
              .dropdown-menu.dropdown-menu-right
                = render 'layouts/header/current_user_dropdown'
          - if has_impersonation_link
            %li.nav-item.impersonation.ml-0
              = link_to admin_impersonation_path, class: 'nav-link impersonation-btn', method: :delete, title: _('Stop impersonation'), aria: { label: _('Stop impersonation') }, data: { toggle: 'tooltip', placement: 'bottom', container: 'body', qa_selector: 'stop_impersonation_link' } do
                = sprite_icon('incognito', size: 18)
          - if header_link?(:sign_in)
            %li.nav-item
              %div
                - sign_in_text = allow_signup? ? _('Sign in / Register') : _('Sign in')
                = link_to sign_in_text, new_session_path(:user, redirect_to_referer: 'yes'), class: 'btn btn-sign-in'

      %button.navbar-toggler.d-block.d-sm-none{ type: 'button' }
        %span.sr-only= _('Toggle navigation')
        = sprite_icon('ellipsis_h', size: 12, css_class: 'more-icon js-navbar-toggle-right')
        = sprite_icon('close', size: 12, css_class: 'close-icon js-navbar-toggle-left')

- if ::Feature.enabled?(:whats_new_drawer, current_user)
  #whats-new-app{ data: { storage_key: whats_new_storage_key } }

- if can?(current_user, :update_user_status, current_user)
  .js-set-status-modal-wrapper{ data: user_status_data }