diff options
Diffstat (limited to 'app/views/layouts')
6 files changed, 92 insertions, 8 deletions
diff --git a/app/views/layouts/_init_auto_complete.html.haml b/app/views/layouts/_init_auto_complete.html.haml index 509f5be8097..46d84d9f883 100644 --- a/app/views/layouts/_init_auto_complete.html.haml +++ b/app/views/layouts/_init_auto_complete.html.haml @@ -1,5 +1,5 @@ - object = @target_project || @project || @group -- noteable_type = @noteable.class if @noteable.present? +- noteable_type = @noteable_type || @noteable&.class - datasources = autocomplete_data_sources(object, noteable_type) diff --git a/app/views/layouts/header/_default.html.haml b/app/views/layouts/header/_default.html.haml index 69b8518ef33..d0a06c7d5bf 100644 --- a/app/views/layouts/header/_default.html.haml +++ b/app/views/layouts/header/_default.html.haml @@ -19,8 +19,18 @@ %span.gl-badge.gl-bg-green-500.gl-text-white.gl-rounded-pill.gl-font-weight-bold.gl-py-1 = _('Next') - .gl-display-none.gl-sm-display-block - = render "layouts/nav/top_nav" + - if current_user + .gl-display-none.gl-sm-display-block + = render "layouts/nav/top_nav" + - else + - experiment(:logged_out_marketing_header, actor: nil) do |e| + - e.candidate do + = render 'layouts/header/marketing_links' + - e.try(:trial_focused) do + = render 'layouts/header/marketing_links' + - e.control do + .gl-display-none.gl-sm-display-block + = render "layouts/nav/top_nav" .navbar-collapse.collapse %ul.nav.navbar-nav @@ -38,7 +48,7 @@ 'autocomplete-path' => search_autocomplete_path } } .gl-search-box-by-type = sprite_icon('search', css_class: 'gl-search-box-by-type-search-icon gl-icon') - %input{ type: "text", placeholder: _('Search or jump to...'), class: 'form-control gl-form-input gl-search-box-by-type-input', id: 'search', autocomplete: 'off' } + %input{ type: "text", placeholder: s_('GlobalSearch|Search GitLab'), class: 'form-control gl-form-input gl-search-box-by-type-input', id: 'search', autocomplete: 'off' } - else = render 'layouts/search' %li.nav-item{ class: 'd-none d-sm-inline-block d-lg-none' } @@ -104,6 +114,15 @@ = sprite_icon('chevron-down', css_class: 'caret-down') .dropdown-menu.dropdown-menu-right = render 'layouts/header/help_dropdown' + - unless current_user + - experiment(:logged_out_marketing_header, actor: nil) do |e| + - e.candidate do + %li.nav-item.gl-display-none.gl-sm-display-block + = render "layouts/nav/top_nav" + - e.try(:trial_focused) do + %li.nav-item.gl-display-none.gl-sm-display-block + = render "layouts/nav/top_nav" + - e.control {} - if header_link?(:user_dropdown) %li.nav-item.header-user.js-nav-user-dropdown.dropdown{ data: { track_label: "profile_dropdown", track_action: "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 @@ -117,10 +136,23 @@ = 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: 'gl-button btn btn-default btn-sign-in' + - experiment(:logged_out_marketing_header, actor: nil) do |e| + - e.candidate do + %li.nav-item.gl-display-none.gl-sm-display-block + = link_to _('Sign up now'), new_user_registration_path, class: 'gl-button btn btn-default btn-sign-in' + %li.nav-item.gl-display-none.gl-sm-display-block + = link_to _('Login'), new_session_path(:user, redirect_to_referer: 'yes') + = render 'layouts/header/sign_in_register_button', class: 'gl-sm-display-none' + - e.try(:trial_focused) do + %li.nav-item.gl-display-none.gl-sm-display-block + = link_to _('Get a free trial'), 'https://about.gitlab.com/free-trial/', class: 'gl-button btn btn-default btn-sign-in' + %li.nav-item.gl-display-none.gl-sm-display-block + = link_to _('Sign up'), new_user_registration_path + %li.nav-item.gl-display-none.gl-sm-display-block + = link_to _('Login'), new_session_path(:user, redirect_to_referer: 'yes') + = render 'layouts/header/sign_in_register_button', class: 'gl-sm-display-none' + - e.control do + = render 'layouts/header/sign_in_register_button' %button.navbar-toggler.d-block.d-sm-none{ type: 'button', class: 'gl-border-none!', data: { testid: 'top-nav-responsive-toggle', qa_selector: 'mobile_navbar_button' } } %span.sr-only= _('Toggle navigation') diff --git a/app/views/layouts/header/_gitlab_version.html.haml b/app/views/layouts/header/_gitlab_version.html.haml new file mode 100644 index 00000000000..125fbaa084c --- /dev/null +++ b/app/views/layouts/header/_gitlab_version.html.haml @@ -0,0 +1,11 @@ +- return unless show_version_check? + +.gl-display-flex.gl-flex-direction-column.gl-px-4.gl-py-3 + %span + = s_("VersionCheck|Your GitLab Version") + = emoji_icon('rocket') + %span + %span.gl-font-sm.gl-text-gray-500 + #{Gitlab.version_info.major}.#{Gitlab.version_info.minor} + %span.gl-ml-2 + .js-gitlab-version-check{ data: { "size": "sm" } } diff --git a/app/views/layouts/header/_help_dropdown.html.haml b/app/views/layouts/header/_help_dropdown.html.haml index e2c7781da54..738bca2f2cc 100644 --- a/app/views/layouts/header/_help_dropdown.html.haml +++ b/app/views/layouts/header/_help_dropdown.html.haml @@ -1,5 +1,6 @@ %ul - if current_user_menu?(:help) + = render 'layouts/header/gitlab_version' = render 'layouts/header/whats_new_dropdown_item' %li = link_to _("Help"), help_path diff --git a/app/views/layouts/header/_marketing_links.html.haml b/app/views/layouts/header/_marketing_links.html.haml new file mode 100644 index 00000000000..24069de394d --- /dev/null +++ b/app/views/layouts/header/_marketing_links.html.haml @@ -0,0 +1,34 @@ +%ul.nav.navbar-sub-nav.gl-display-none.gl-lg-display-flex.gl-align-items-center + %li.dropdown.gl-mr-3 + %button{ type: "button", data: { toggle: "dropdown" } } + = s_('LoggedOutMarketingHeader|About GitLab') + = sprite_icon('chevron-down', css_class: 'caret-down') + .dropdown-menu + %ul + %li + = link_to 'https://about.gitlab.com/stages-devops-lifecycle/' do + = s_('LoggedOutMarketingHeader|GitLab: the DevOps platform') + %li + = link_to explore_root_path do + = s_('LoggedOutMarketingHeader|Explore GitLab') + %li + = link_to 'https://about.gitlab.com/install/' do + = s_('LoggedOutMarketingHeader|Install GitLab') + %li + = link_to 'https://about.gitlab.com/is-it-any-good/' do + = s_('LoggedOutMarketingHeader|How GitLab compares') + %li + = link_to 'https://about.gitlab.com/get-started/' do + = s_('LoggedOutMarketingHeader|Get started') + %li + = link_to 'https://docs.gitlab.com/' do + = s_('LoggedOutMarketingHeader|GitLab docs') + %li + = link_to 'https://about.gitlab.com/learn/' do + = s_('LoggedOutMarketingHeader|GitLab Learn') + %li.gl-mr-3 + = link_to 'https://about.gitlab.com/pricing/' do + = s_('LoggedOutMarketingHeader|Pricing') + %li.gl-mr-3 + = link_to 'https://about.gitlab.com/sales/' do + = s_('LoggedOutMarketingHeader|Talk to an expert') diff --git a/app/views/layouts/header/_sign_in_register_button.html.haml b/app/views/layouts/header/_sign_in_register_button.html.haml new file mode 100644 index 00000000000..992e8785251 --- /dev/null +++ b/app/views/layouts/header/_sign_in_register_button.html.haml @@ -0,0 +1,6 @@ +- top_class = local_assigns.fetch(:class, nil) + +%li.nav-item{ class: top_class } + %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: 'gl-button btn btn-default btn-sign-in' |