From 79a842c53d77e9b5b95c538372ac263c28864659 Mon Sep 17 00:00:00 2001 From: Phil Hughes <me@iamphill.com> Date: Wed, 21 Jun 2017 14:45:05 +0100 Subject: [PATCH] fixed scss-lint job only display the toggle setting in development env for now --- .../stylesheets/framework/variables.scss | 4 ++ app/assets/stylesheets/new_nav.scss | 10 ++--- app/helpers/application_helper.rb | 4 ++ app/views/layouts/header/_default.html.haml | 5 ++- app/views/profiles/preferences/show.html.haml | 37 ++++++++++--------- 5 files changed, 34 insertions(+), 26 deletions(-) diff --git a/app/assets/stylesheets/framework/variables.scss b/app/assets/stylesheets/framework/variables.scss index 71513199d84..7a40143ad7d 100644 --- a/app/assets/stylesheets/framework/variables.scss +++ b/app/assets/stylesheets/framework/variables.scss @@ -74,6 +74,10 @@ $red-700: #a62d19; $red-800: #8b2615; $red-900: #711e11; +$purple-700: #2d0573; +$purple-800: #451c7f; +$purple-900: #380d75; + $black: #000; $black-transparent: rgba(0, 0, 0, 0.3); diff --git a/app/assets/stylesheets/new_nav.scss b/app/assets/stylesheets/new_nav.scss index ddcbd6b6f07..d24fd3b160d 100644 --- a/app/assets/stylesheets/new_nav.scss +++ b/app/assets/stylesheets/new_nav.scss @@ -2,11 +2,9 @@ @import 'framework/tw_bootstrap_variables'; @import "bootstrap/variables"; -$new-navbar-bg: #380D75; - header.navbar-gitlab-new { color: $gray-normal; - background-color: $new-navbar-bg; + background-color: $purple-900; .header-content { padding-left: 0; @@ -134,7 +132,7 @@ header.navbar-gitlab-new { .search { form { - border-color: #2D0573; + border-color: $purple-700; &:hover { border-color: rgba($white-light, .5); @@ -147,7 +145,7 @@ header.navbar-gitlab-new { form, .search-input { - background-color: #451C7F; + background-color: $purple-800; } .search-input { @@ -160,7 +158,7 @@ header.navbar-gitlab-new { .location-badge { color: $white-light; - background-color: $new-navbar-bg; + background-color: $purple-900; } &.search-active { diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 46be72ad81c..dc7ff78f3df 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -301,6 +301,10 @@ module ApplicationHelper end end + def can_toggle_new_nav? + Rails.env.development? + end + def show_new_nav? cookies["new_nav"] == "true" end diff --git a/app/views/layouts/header/_default.html.haml b/app/views/layouts/header/_default.html.haml index 34dcde38908..f056c0af968 100644 --- a/app/views/layouts/header/_default.html.haml +++ b/app/views/layouts/header/_default.html.haml @@ -74,8 +74,9 @@ = link_to "Profile", current_user, class: 'profile-link', data: { user: current_user.username } %li = link_to "Settings", profile_path - %li - = link_to "Turn on new nav", profile_preferences_path(anchor: "new-navigation") + - if can_toggle_new_nav? + %li + = link_to "Turn on new nav", profile_preferences_path(anchor: "new-navigation") %li.divider %li = link_to "Sign out", destroy_user_session_path, method: :delete, class: "sign-out-link" diff --git a/app/views/profiles/preferences/show.html.haml b/app/views/profiles/preferences/show.html.haml index e25d36222f7..0b5995415e9 100644 --- a/app/views/profiles/preferences/show.html.haml +++ b/app/views/profiles/preferences/show.html.haml @@ -15,24 +15,25 @@ .preview= image_tag "#{scheme.css_class}-scheme-preview.png" = f.radio_button :color_scheme_id, scheme.id = scheme.name - .col-sm-12 - %hr - .col-lg-3.profile-settings-sidebar#new-navigation - %h4.prepend-top-0 - New Navigation - %p - This setting allows you to turn on or off the new upcoming navigation concept. - = succeed '.' do - = link_to 'Learn more', '', target: '_blank' - .col-lg-9.syntax-theme - = label_tag do - .preview= image_tag "old_nav.png" - %input.js-experiment-feature-toggle{ type: "radio", value: "false", name: "new_nav", checked: !show_new_nav? } - Old - = label_tag do - .preview= image_tag "new_nav.png" - %input.js-experiment-feature-toggle{ type: "radio", value: "true", name: "new_nav", checked: show_new_nav? } - New + - if can_toggle_new_nav? + .col-sm-12 + %hr + .col-lg-3.profile-settings-sidebar#new-navigation + %h4.prepend-top-0 + New Navigation + %p + This setting allows you to turn on or off the new upcoming navigation concept. + = succeed '.' do + = link_to 'Learn more', '', target: '_blank' + .col-lg-9.syntax-theme + = label_tag do + .preview= image_tag "old_nav.png" + %input.js-experiment-feature-toggle{ type: "radio", value: "false", name: "new_nav", checked: !show_new_nav? } + Old + = label_tag do + .preview= image_tag "new_nav.png" + %input.js-experiment-feature-toggle{ type: "radio", value: "true", name: "new_nav", checked: show_new_nav? } + New .col-sm-12 %hr .col-lg-3.profile-settings-sidebar -- 2.30.9