Commit f4859b93 authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets

Merge branch 'top-navigation-concept' into 'master'

Implement top navigation for profile area

Main idea is to keep left sidebar static so user is not confused by
changing context. Instead we put changing navigation with changing
content in one main block. I used profile area as a simplest way to 
implement and test this concept. Your feedback is welcome in comments

For https://gitlab.com/gitlab-org/gitlab-ce/issues/14354#note_4878536Signed-off-by: default avatarDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>

See merge request !3824
parents 7f3a22a7 f93b0f3e
...@@ -84,6 +84,14 @@ module PageLayoutHelper ...@@ -84,6 +84,14 @@ module PageLayoutHelper
end end
end end
def nav(name = nil)
if name
@nav = name
else
@nav
end
end
def fluid_layout(enabled = false) def fluid_layout(enabled = false)
if @fluid_layout.nil? if @fluid_layout.nil?
@fluid_layout = (current_user && current_user.layout == "fluid") || enabled @fluid_layout = (current_user && current_user.layout == "fluid") || enabled
......
...@@ -110,4 +110,12 @@ module TabHelper ...@@ -110,4 +110,12 @@ module TabHelper
'active' 'active'
end end
end end
def profile_tab_class
if controller.controller_path =~ /\Aprofiles/
return 'active'
end
'active' if current_controller?('oauth/applications')
end
end end
- page_title "Applications" - page_title "Applications"
- header_title page_title, applications_profile_path
.row.prepend-top-default .row.prepend-top-default
.col-lg-3.profile-settings-sidebar .col-lg-3.profile-settings-sidebar
......
...@@ -25,6 +25,10 @@ ...@@ -25,6 +25,10 @@
.content-wrapper .content-wrapper
= render "layouts/flash" = render "layouts/flash"
= yield :flash_message = yield :flash_message
- if defined?(nav) && nav
.layout-nav
%div{ class: container_class }
= render "layouts/nav/#{nav}"
%div{ class: (container_class unless @no_container) } %div{ class: (container_class unless @no_container) }
.content .content
.clearfix .clearfix
......
...@@ -6,6 +6,6 @@ ...@@ -6,6 +6,6 @@
= yield :scripts_body_top = yield :scripts_body_top
= render "layouts/header/default", title: header_title = render "layouts/header/default", title: header_title
= render 'layouts/page', sidebar: sidebar = render 'layouts/page', sidebar: sidebar, nav: nav
= yield :scripts_body = yield :scripts_body
...@@ -48,8 +48,7 @@ ...@@ -48,8 +48,7 @@
%span %span
Help Help
%li.separate-item = nav_link(html_options: {class: profile_tab_class}) do
= nav_link(controller: :profile) do
= link_to profile_path, title: 'Profile Settings', data: {placement: 'bottom'} do = link_to profile_path, title: 'Profile Settings', data: {placement: 'bottom'} do
= icon('user fw') = icon('user fw')
%span %span
......
%ul.nav.nav-sidebar %ul.nav-links
= nav_link do
= link_to root_path, title: 'Go to dashboard', class: 'back-link' do
= icon('caret-square-o-left fw')
%span
Go to dashboard
%li.separate-item
= nav_link(path: 'profiles#show', html_options: {class: 'home'}) do = nav_link(path: 'profiles#show', html_options: {class: 'home'}) do
= link_to profile_path, title: 'Profile Settings' do = link_to profile_path, title: 'Profile Settings' do
= icon('user fw') = icon('user fw')
%span %span
Profile Settings Profile
= nav_link(controller: [:accounts, :two_factor_auths]) do = nav_link(controller: [:accounts, :two_factor_auths]) do
= link_to profile_account_path, title: 'Account' do = link_to profile_account_path, title: 'Account' do
= icon('gear fw') = icon('gear fw')
...@@ -27,7 +19,6 @@ ...@@ -27,7 +19,6 @@
= icon('envelope-o fw') = icon('envelope-o fw')
%span %span
Emails Emails
%span.count= number_with_delimiter(current_user.emails.count + 1)
- unless current_user.ldap_user? - unless current_user.ldap_user?
= nav_link(controller: :passwords) do = nav_link(controller: :passwords) do
= link_to edit_profile_password_path, title: 'Password' do = link_to edit_profile_password_path, title: 'Password' do
...@@ -45,7 +36,6 @@ ...@@ -45,7 +36,6 @@
= icon('key fw') = icon('key fw')
%span %span
SSH Keys SSH Keys
%span.count= number_with_delimiter(current_user.keys.count)
= nav_link(controller: :preferences) do = nav_link(controller: :preferences) do
= link_to profile_preferences_path, title: 'Preferences' do = link_to profile_preferences_path, title: 'Preferences' do
-# TODO (rspeicher): Better icon? -# TODO (rspeicher): Better icon?
......
- page_title "Profile Settings" - page_title "Profile Settings"
- header_title "Profile Settings", profile_path unless header_title - header_title "Profile Settings", profile_path unless header_title
- sidebar "profile" - sidebar "dashboard"
- nav "profile"
= render template: "layouts/application" = render template: "layouts/application"
- page_title "Account" - page_title "Account"
- header_title page_title, profile_account_path
- if current_user.ldap_user? - if current_user.ldap_user?
.alert.alert-info .alert.alert-info
......
- page_title "Audit Log" - page_title "Audit Log"
- header_title page_title, audit_log_profile_path
.row.prepend-top-default .row.prepend-top-default
.col-lg-3.profile-settings-sidebar .col-lg-3.profile-settings-sidebar
......
- page_title "Emails" - page_title "Emails"
- header_title page_title, profile_emails_path
.row.prepend-top-default .row.prepend-top-default
.col-lg-3.profile-settings-sidebar .col-lg-3.profile-settings-sidebar
......
- page_title "SSH Keys" - page_title "SSH Keys"
- header_title page_title, profile_keys_path
.row.prepend-top-default .row.prepend-top-default
.col-lg-3.profile-settings-sidebar .col-lg-3.profile-settings-sidebar
......
- page_title "Notifications" - page_title "Notifications"
- header_title page_title, profile_notifications_path
%div %div
- if @user.errors.any? - if @user.errors.any?
......
- page_title "Password" - page_title "Password"
- header_title page_title, edit_profile_password_path
.row.prepend-top-default .row.prepend-top-default
.col-lg-3.profile-settings-sidebar .col-lg-3.profile-settings-sidebar
......
- page_title 'Preferences' - page_title 'Preferences'
- header_title page_title, profile_preferences_path
= form_for @user, url: profile_preferences_path, remote: true, method: :put, html: {class: 'row prepend-top-default js-preferences-form'} do |f| = form_for @user, url: profile_preferences_path, remote: true, method: :put, html: {class: 'row prepend-top-default js-preferences-form'} do |f|
.col-lg-3.profile-settings-sidebar .col-lg-3.profile-settings-sidebar
......
...@@ -22,4 +22,8 @@ class Spinach::Features::ProfileActiveTab < Spinach::FeatureSteps ...@@ -22,4 +22,8 @@ class Spinach::Features::ProfileActiveTab < Spinach::FeatureSteps
step 'the active main tab should be Audit Log' do step 'the active main tab should be Audit Log' do
ensure_active_main_tab('Audit Log') ensure_active_main_tab('Audit Log')
end end
def ensure_active_main_tab(content)
expect(find('.layout-nav li.active')).to have_content(content)
end
end end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment