Commit 76ae8719 authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets

Merge branch 'refactor-header' into 'master'

Refactor header css/html

* Fixes UI issue with header on zoom
* Replace duplicate numbers with variable
* Better names for css classes
* refactor header views

Fixes #1640

See merge request !750
parents a42f4d85 01f6ae23
...@@ -177,6 +177,10 @@ $ -> ...@@ -177,6 +177,10 @@ $ ->
$(@).next('table').show() $(@).next('table').show()
$(@).remove() $(@).remove()
$('.navbar-toggle').on 'click', ->
$('.header-content .title').toggle()
$('.header-content .navbar-collapse').toggle()
# Show/hide comments on diff # Show/hide comments on diff
$("body").on "click", ".js-toggle-diff-comments", (e) -> $("body").on "click", ".js-toggle-diff-comments", (e) ->
$(@).toggleClass('active') $(@).toggleClass('active')
......
...@@ -5,6 +5,7 @@ $gl-link-color: #446e9b; ...@@ -5,6 +5,7 @@ $gl-link-color: #446e9b;
$nprogress-color: #c0392b; $nprogress-color: #c0392b;
$gl-font-size: 14px; $gl-font-size: 14px;
$list-font-size: 15px; $list-font-size: 15px;
$sidebar_collapsed_width: 52px;
$sidebar_width: 230px; $sidebar_width: 230px;
$avatar_radius: 50%; $avatar_radius: 50%;
$code_font_size: 13px; $code_font_size: 13px;
......
...@@ -307,7 +307,7 @@ table { ...@@ -307,7 +307,7 @@ table {
} }
.btn-sign-in { .btn-sign-in {
margin-top: 5px; margin-top: 7px;
text-shadow: none; text-shadow: none;
} }
......
...@@ -2,7 +2,14 @@ ...@@ -2,7 +2,14 @@
* Application Header * Application Header
* *
*/ */
$header-height: 46px;
header { header {
&.navbar-empty {
background: #FFF;
border-bottom: 1px solid #EEE;
}
&.navbar-gitlab { &.navbar-gitlab {
z-index: 100; z-index: 100;
margin-bottom: 0; margin-bottom: 0;
...@@ -11,56 +18,11 @@ header { ...@@ -11,56 +18,11 @@ header {
width: 100%; width: 100%;
.container { .container {
background: #FFF;
width: 100% !important; width: 100% !important;
padding: 0; padding: 0;
padding-right: 35px;
background: #FFF;
border-bottom: 1px solid #EEE;
filter: none; filter: none;
.title {
position: relative;
float: left;
margin: 0;
margin-left: 25px;
font-size: 18px;
line-height: 44px;
font-weight: bold;
color: #444;
@include str-truncated(37%);
a {
color: #444;
&:hover {
text-decoration: underline;
}
}
}
.app_logo {
border-bottom: 1px solid transparent;
margin-bottom: -1px;
a {
padding: 5px 8px;
img {
float: left;
}
h3 {
width: 158px;
float: left;
margin: 0;
margin-left: 20px;
font-size: 18px;
line-height: 34px;
font-weight: normal;
}
}
}
.nav > li > a { .nav > li > a {
color: #888; color: #888;
font-size: 14px; font-size: 14px;
...@@ -80,89 +42,80 @@ header { ...@@ -80,89 +42,80 @@ header {
} }
} }
/** NAV block with links and profile **/
.nav {
float: right;
margin-right: 0;
}
.navbar-toggle { .navbar-toggle {
color: #666; color: #666;
margin: 0; margin: 0;
border-radius: 0; border-radius: 0;
position: absolute;
right: 2px;
&:hover { &:hover {
background-color: #EEE; background-color: #EEE;
} }
} }
} }
.turbolink-spinner {
font-size: 20px;
margin-right: 10px;
}
@media (max-width: $screen-xs-max) {
border-width: 0;
font-size: 18px;
.title {
@include str-truncated(70%);
}
.navbar-collapse {
margin-top: 47px;
}
.navbar-nav {
margin: 5px 0;
.visible-xs, .visable-sm {
display: table-cell !important;
}
}
li {
display: table-cell;
width: 1%;
a {
text-align: center;
font-size: 18px !important;
}
}
}
} }
/** .header-logo {
* border-bottom: 1px solid transparent;
* Logo holder
*
*/
.app_logo {
float: left; float: left;
margin-right: 9px; height: $header-height;
width: $sidebar_width;
a { a {
float: left; float: left;
height: 46px; height: $header-height;
width: 100%; width: 100%;
padding: 5px 8px;
h3 {
width: 158px;
float: left;
margin: 0;
margin-left: 20px;
font-size: 18px;
line-height: 34px;
font-weight: normal;
}
img { img {
width: 36px; width: 36px;
height: 36px; height: 36px;
float: left;
} }
} }
&:hover { &:hover {
background-color: #EEE; background-color: #EEE;
} }
} }
/** .header-content {
* border-bottom: 1px solid #EEE;
* Search box padding-right: 35px;
* height: $header-height;
*/
.title {
position: relative;
float: left;
margin: 0;
margin-left: 35px;
font-size: 18px;
line-height: 44px;
font-weight: bold;
color: #444;
@include str-truncated(37%);
a {
color: #444;
&:hover {
text-decoration: underline;
}
}
}
}
.search { .search {
margin-right: 10px; margin-right: 10px;
margin-left: 10px; margin-left: 10px;
...@@ -174,6 +127,7 @@ header { ...@@ -174,6 +127,7 @@ header {
} }
.search-input { .search-input {
width: 220px;
background-image: image-url("icon-search.png"); background-image: image-url("icon-search.png");
background-repeat: no-repeat; background-repeat: no-repeat;
background-position: 10px; background-position: 10px;
...@@ -194,41 +148,61 @@ header { ...@@ -194,41 +148,61 @@ header {
} }
} }
.search .search-input { @mixin collapsed-header {
width: 300px; .header-logo {
} width: $sidebar_collapsed_width;
@media (max-width: 1200px) { h3 {
.search .search-input { display: none;
width: 200px; }
} }
}
@media (max-width: $screen-xs-max) { .header-content {
#nprogress .spinner { .title {
right: 35px !important; margin-left: 30px;
}
} }
} }
@media (max-width: $screen-md-max) { @media (max-width: $screen-md-max) {
.header-collapsed, .header-expanded { header .container .title {
width: 52px; max-width: 43%;
}
h3 { .header-collapsed, .header-expanded {
display: none; @include collapsed-header;
}
} }
} }
@media(min-width: $screen-md-max) { @media(min-width: $screen-md-max) {
.header-collapsed { .header-collapsed {
width: 52px; @include collapsed-header;
h3 {
display: none;
}
} }
.header-expanded { .header-expanded {
} }
} }
@media (max-width: $screen-xs-max) {
header .container {
font-size: 18px;
.title {
max-width: 70%;
}
.navbar-nav {
margin: 0px;
float: none !important;
.visible-xs, .visable-sm {
display: table-cell !important;
}
}
li {
display: table-cell;
width: 1%;
}
}
}
...@@ -57,7 +57,7 @@ ...@@ -57,7 +57,7 @@
} }
.container .title { .container .title {
margin-left: 6px !important; margin-left: 15px !important;
max-width: 70% !important; max-width: 70% !important;
} }
} }
......
.page-with-sidebar { .page-with-sidebar {
background: $background-color;
.sidebar-wrapper { .sidebar-wrapper {
position: fixed; position: fixed;
top: 0; top: 0;
...@@ -102,13 +100,13 @@ ...@@ -102,13 +100,13 @@
padding-left: 50px; padding-left: 50px;
.sidebar-wrapper { .sidebar-wrapper {
width: 52px; width: $sidebar_collapsed_width;
.nav-sidebar { .nav-sidebar {
margin-top: 29px; margin-top: 29px;
position: fixed; position: fixed;
top: 45px; top: 45px;
width: 52px; width: $sidebar_collapsed_width;
li a { li a {
padding-left: 18px; padding-left: 18px;
...@@ -125,7 +123,7 @@ ...@@ -125,7 +123,7 @@
.collapse-nav a { .collapse-nav a {
left: 0px; left: 0px;
width: 52px; width: $sidebar_collapsed_width;
} }
.sidebar-user { .sidebar-user {
......
@mixin gitlab-theme($color-light, $color, $color-darker, $color-dark) { @mixin gitlab-theme($color-light, $color, $color-darker, $color-dark) {
header { header {
&.navbar-gitlab { &.navbar-gitlab {
.app_logo { .header-logo {
background-color: $color-darker; background-color: $color-darker;
border-color: $color-darker;
a { a {
color: $color-light; color: $color-light;
...@@ -19,8 +20,6 @@ ...@@ -19,8 +20,6 @@
} }
.page-with-sidebar { .page-with-sidebar {
background: $color-darker;
.collapse-nav a { .collapse-nav a {
color: #FFF; color: #FFF;
background: $color; background: $color;
......
%header.navbar.navbar-fixed-top.navbar-gitlab{ class: nav_header_class }
.container
%div.app_logo
= link_to root_path, class: 'home', title: 'Dashboard', id: 'js-shortcuts-home', data: {toggle: 'tooltip', placement: 'bottom'} do
= brand_header_logo
%h3 GitLab
%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'
%header.navbar.navbar-fixed-top.navbar-gitlab{ class: nav_header_class }
.container
%div.app_logo
= link_to explore_root_path, class: "home" do
= brand_header_logo
%h3 GitLab
%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'
...@@ -3,8 +3,8 @@ ...@@ -3,8 +3,8 @@
= render "layouts/head" = render "layouts/head"
%body{class: "#{app_theme}", :'data-page' => body_data_page} %body{class: "#{app_theme}", :'data-page' => body_data_page}
- if current_user - if current_user
= render "layouts/head_panel", title: header_title = render "layouts/header/default", title: header_title
- else - else
= render "layouts/public_head_panel", title: header_title = render "layouts/header/public", title: header_title
= render 'layouts/page', sidebar: sidebar = render 'layouts/page', sidebar: sidebar
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
%html{ lang: "en"} %html{ lang: "en"}
= render "layouts/head" = render "layouts/head"
%body.ui_mars.login-page.application %body.ui_mars.login-page.application
= render "layouts/empty_head_panel" = render "layouts/header/empty"
= render "layouts/broadcast" = render "layouts/broadcast"
.container.navless-container .container.navless-container
.content .content
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
%html{ lang: "en"} %html{ lang: "en"}
= render "layouts/head" = render "layouts/head"
%body{class: "#{app_theme} application"} %body{class: "#{app_theme} application"}
= render "layouts/head_panel", title: "" if current_user = render "layouts/header/empty"
.container.navless-container .container.navless-container
= render "layouts/flash" = render "layouts/flash"
.error-page .error-page
......
%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
%span.sr-only Toggle navigation
= icon('bars')
.navbar-collapse.collapse
%ul.nav.navbar-nav.pull-right
%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'
%header.navbar.navbar-fixed-top.navbar-gitlab %header.navbar.navbar-fixed-top.navbar-empty
.container .container
%h4.center %h4.center
= image_tag 'logo-white.png', width: 32, height: 32 = image_tag 'logo-white.png', width: 32, height: 32
%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'
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