From e7e07fab5d64db8b2881d7fa3477553807b0d3e1 Mon Sep 17 00:00:00 2001 From: Dmitriy Zaporozhets Date: Mon, 1 Jun 2015 17:09:30 +0200 Subject: Refactor header views Signed-off-by: Dmitriy Zaporozhets --- app/views/layouts/_empty_head_panel.html.haml | 4 --- app/views/layouts/_head_panel.html.haml | 43 -------------------------- app/views/layouts/_public_head_panel.html.haml | 23 -------------- app/views/layouts/application.html.haml | 4 +-- app/views/layouts/devise.html.haml | 2 +- app/views/layouts/errors.html.haml | 2 +- app/views/layouts/header/_default.html.haml | 43 ++++++++++++++++++++++++++ app/views/layouts/header/_empty.html.haml | 4 +++ app/views/layouts/header/_public.html.haml | 14 +++++++++ 9 files changed, 65 insertions(+), 74 deletions(-) delete mode 100644 app/views/layouts/_empty_head_panel.html.haml delete mode 100644 app/views/layouts/_head_panel.html.haml delete mode 100644 app/views/layouts/_public_head_panel.html.haml create mode 100644 app/views/layouts/header/_default.html.haml create mode 100644 app/views/layouts/header/_empty.html.haml create mode 100644 app/views/layouts/header/_public.html.haml diff --git a/app/views/layouts/_empty_head_panel.html.haml b/app/views/layouts/_empty_head_panel.html.haml deleted file mode 100644 index 16fbf6d4020..00000000000 --- a/app/views/layouts/_empty_head_panel.html.haml +++ /dev/null @@ -1,4 +0,0 @@ -%header.navbar.navbar-fixed-top.navbar-empty - .container - %h4.center - = image_tag 'logo-white.png', width: 32, height: 32 diff --git a/app/views/layouts/_head_panel.html.haml b/app/views/layouts/_head_panel.html.haml deleted file mode 100644 index 43076ee8869..00000000000 --- a/app/views/layouts/_head_panel.html.haml +++ /dev/null @@ -1,43 +0,0 @@ -%header.navbar.navbar-fixed-top.navbar-gitlab{ class: nav_header_class } - .container - .header-logo - = link_to root_path, class: 'home', title: 'Dashboard', id: 'js-shortcuts-home', data: {toggle: 'tooltip', placement: 'bottom'} do - = brand_header_logo - %h3 GitLab - .header-content - %h1.title - = title - - %button.navbar-toggle{type: 'button', data: {target: '.navbar-collapse', toggle: 'collapse'}} - %span.sr-only Toggle navigation - = icon('bars') - - .navbar-collapse.collapse - %ul.nav.navbar-nav - %li.hidden-sm.hidden-xs - = render 'layouts/search' - %li.visible-sm.visible-xs - = link_to search_path, title: 'Search', data: {toggle: 'tooltip', placement: 'bottom'} do - = icon('search') - %li - = link_to help_path, title: 'Help', data: {toggle: 'tooltip', placement: 'bottom'} do - = icon('question-circle fw') - %li - = link_to explore_root_path, title: 'Explore', data: {toggle: 'tooltip', placement: 'bottom'} do - = icon('globe fw') - %li - = link_to user_snippets_path(current_user), title: 'Your snippets', data: {toggle: 'tooltip', placement: 'bottom'} do - = icon('clipboard fw') - - if current_user.is_admin? - %li - = link_to admin_root_path, title: 'Admin area', data: {toggle: 'tooltip', placement: 'bottom'} do - = icon('wrench fw') - - if current_user.can_create_project? - %li - = link_to new_project_path, title: 'New project', data: {toggle: 'tooltip', placement: 'bottom'} do - = icon('plus fw') - %li - = link_to profile_path, title: 'Profile settings', data: {toggle: 'tooltip', placement: 'bottom'} do - = icon('cog fw') - -= render 'shared/outdated_browser' diff --git a/app/views/layouts/_public_head_panel.html.haml b/app/views/layouts/_public_head_panel.html.haml deleted file mode 100644 index 5cccf9a6ad2..00000000000 --- a/app/views/layouts/_public_head_panel.html.haml +++ /dev/null @@ -1,23 +0,0 @@ -%header.navbar.navbar-fixed-top.navbar-gitlab{ class: nav_header_class } - .container - .header-logo - = link_to explore_root_path, class: "home" do - = brand_header_logo - %h3 GitLab - .header-content - %h1.title= title - - %button.navbar-toggle{"data-target" => ".navbar-collapse", "data-toggle" => "collapse", type: "button"} - %span.sr-only Toggle navigation - %i.fa.fa-bars - - - unless current_controller?('sessions') - .pull-right.hidden-xs - = link_to "Sign in", new_session_path(:user, redirect_to_referer: 'yes'), class: 'btn btn-sign-in btn-new append-right-10' - - .navbar-collapse.collapse - %ul.nav.navbar-nav - %li.visible-xs - = link_to "Sign in", new_session_path(:user, redirect_to_referer: 'yes') - -= render 'shared/outdated_browser' diff --git a/app/views/layouts/application.html.haml b/app/views/layouts/application.html.haml index a97feeb1ecd..155825cc4c2 100644 --- a/app/views/layouts/application.html.haml +++ b/app/views/layouts/application.html.haml @@ -3,8 +3,8 @@ = render "layouts/head" %body{class: "#{app_theme}", :'data-page' => body_data_page} - if current_user - = render "layouts/head_panel", title: header_title + = render "layouts/header/default", title: header_title - else - = render "layouts/public_head_panel", title: header_title + = render "layouts/header/public", title: header_title = render 'layouts/page', sidebar: sidebar diff --git a/app/views/layouts/devise.html.haml b/app/views/layouts/devise.html.haml index 5a59c9fd59a..d406f5764a7 100644 --- a/app/views/layouts/devise.html.haml +++ b/app/views/layouts/devise.html.haml @@ -2,7 +2,7 @@ %html{ lang: "en"} = render "layouts/head" %body.ui_mars.login-page.application - = render "layouts/empty_head_panel" + = render "layouts/header/empty" = render "layouts/broadcast" .container.navless-container .content diff --git a/app/views/layouts/errors.html.haml b/app/views/layouts/errors.html.haml index 25cce11990a..2e3a2b16eb7 100644 --- a/app/views/layouts/errors.html.haml +++ b/app/views/layouts/errors.html.haml @@ -2,7 +2,7 @@ %html{ lang: "en"} = render "layouts/head" %body{class: "#{app_theme} application"} - = render "layouts/empty_head_panel" + = render "layouts/header/empty" .container.navless-container = render "layouts/flash" .error-page diff --git a/app/views/layouts/header/_default.html.haml b/app/views/layouts/header/_default.html.haml new file mode 100644 index 00000000000..43076ee8869 --- /dev/null +++ b/app/views/layouts/header/_default.html.haml @@ -0,0 +1,43 @@ +%header.navbar.navbar-fixed-top.navbar-gitlab{ class: nav_header_class } + .container + .header-logo + = link_to root_path, class: 'home', title: 'Dashboard', id: 'js-shortcuts-home', data: {toggle: 'tooltip', placement: 'bottom'} do + = brand_header_logo + %h3 GitLab + .header-content + %h1.title + = title + + %button.navbar-toggle{type: 'button', data: {target: '.navbar-collapse', toggle: 'collapse'}} + %span.sr-only Toggle navigation + = icon('bars') + + .navbar-collapse.collapse + %ul.nav.navbar-nav + %li.hidden-sm.hidden-xs + = render 'layouts/search' + %li.visible-sm.visible-xs + = link_to search_path, title: 'Search', data: {toggle: 'tooltip', placement: 'bottom'} do + = icon('search') + %li + = link_to help_path, title: 'Help', data: {toggle: 'tooltip', placement: 'bottom'} do + = icon('question-circle fw') + %li + = link_to explore_root_path, title: 'Explore', data: {toggle: 'tooltip', placement: 'bottom'} do + = icon('globe fw') + %li + = link_to user_snippets_path(current_user), title: 'Your snippets', data: {toggle: 'tooltip', placement: 'bottom'} do + = icon('clipboard fw') + - if current_user.is_admin? + %li + = link_to admin_root_path, title: 'Admin area', data: {toggle: 'tooltip', placement: 'bottom'} do + = icon('wrench fw') + - if current_user.can_create_project? + %li + = link_to new_project_path, title: 'New project', data: {toggle: 'tooltip', placement: 'bottom'} do + = icon('plus fw') + %li + = link_to profile_path, title: 'Profile settings', data: {toggle: 'tooltip', placement: 'bottom'} do + = icon('cog fw') + += render 'shared/outdated_browser' diff --git a/app/views/layouts/header/_empty.html.haml b/app/views/layouts/header/_empty.html.haml new file mode 100644 index 00000000000..16fbf6d4020 --- /dev/null +++ b/app/views/layouts/header/_empty.html.haml @@ -0,0 +1,4 @@ +%header.navbar.navbar-fixed-top.navbar-empty + .container + %h4.center + = image_tag 'logo-white.png', width: 32, height: 32 diff --git a/app/views/layouts/header/_public.html.haml b/app/views/layouts/header/_public.html.haml new file mode 100644 index 00000000000..6a031722aaa --- /dev/null +++ b/app/views/layouts/header/_public.html.haml @@ -0,0 +1,14 @@ +%header.navbar.navbar-fixed-top.navbar-gitlab{ class: nav_header_class } + .container + .header-logo + = link_to explore_root_path, class: "home" do + = brand_header_logo + %h3 GitLab + .header-content + %h1.title= title + + - unless current_controller?('sessions') + .pull-right + = link_to "Sign in", new_session_path(:user, redirect_to_referer: 'yes'), class: 'btn btn-sign-in btn-success btn-sm' + += render 'shared/outdated_browser' -- cgit v1.2.1