Remove all gitlab theme related code
This commit is contained in:
parent
109953885c
commit
4b7f0b327c
17 changed files with 3 additions and 465 deletions
|
@ -101,11 +101,6 @@ require('es6-promise').polyfill();
|
|||
}
|
||||
});
|
||||
|
||||
$('.nav-sidebar').niceScroll({
|
||||
cursoropacitymax: '0.4',
|
||||
cursorcolor: '#FFF',
|
||||
cursorborder: '1px solid #FFF'
|
||||
});
|
||||
$('.js-select-on-focus').on('focusin', function () {
|
||||
return $(this).select().one('mouseup', function (e) {
|
||||
return e.preventDefault();
|
||||
|
|
|
@ -19,7 +19,6 @@
|
|||
@import "framework/flash.scss";
|
||||
@import "framework/forms.scss";
|
||||
@import "framework/gfm.scss";
|
||||
@import "framework/gitlab-theme.scss";
|
||||
@import "framework/header.scss";
|
||||
@import "framework/highlight.scss";
|
||||
@import "framework/issue_box.scss";
|
||||
|
|
|
@ -140,7 +140,6 @@ a {
|
|||
@include transition(background-color, box-shadow);
|
||||
}
|
||||
|
||||
.nav-sidebar a,
|
||||
.dropdown-menu a,
|
||||
.dropdown-menu button,
|
||||
.dropdown-menu-nav a {
|
||||
|
|
|
@ -1,144 +0,0 @@
|
|||
/**
|
||||
* Styles the GitLab application with a specific color theme
|
||||
*
|
||||
* $color-light -
|
||||
* $color -
|
||||
* $color-darker -
|
||||
* $color-dark -
|
||||
*/
|
||||
@mixin gitlab-theme($color-light, $color, $color-darker, $color-dark) {
|
||||
.page-with-sidebar {
|
||||
.toggle-nav-collapse,
|
||||
.pin-nav-btn {
|
||||
color: $color-light;
|
||||
|
||||
&:hover {
|
||||
color: $white-light;
|
||||
}
|
||||
}
|
||||
|
||||
.sidebar-wrapper {
|
||||
background: $color-darker;
|
||||
}
|
||||
|
||||
.sidebar-action-buttons {
|
||||
color: $color-light;
|
||||
background-color: lighten($color-darker, 5%);
|
||||
}
|
||||
|
||||
.nav-sidebar {
|
||||
li {
|
||||
a {
|
||||
color: $color-light;
|
||||
|
||||
&:hover,
|
||||
&:focus,
|
||||
&:active {
|
||||
background: $color-dark;
|
||||
}
|
||||
|
||||
i {
|
||||
color: $color-light;
|
||||
}
|
||||
|
||||
path,
|
||||
polygon {
|
||||
fill: $color-light;
|
||||
}
|
||||
|
||||
.count {
|
||||
color: $color-light;
|
||||
background: $color-dark;
|
||||
}
|
||||
|
||||
svg {
|
||||
position: relative;
|
||||
top: 3px;
|
||||
}
|
||||
}
|
||||
|
||||
&.separate-item {
|
||||
border-top: 1px solid $color;
|
||||
}
|
||||
|
||||
&.active a {
|
||||
color: $white-light;
|
||||
background: $color-dark;
|
||||
|
||||
&.no-highlight {
|
||||
border: none;
|
||||
}
|
||||
|
||||
i {
|
||||
color: $white-light;
|
||||
}
|
||||
|
||||
path,
|
||||
polygon {
|
||||
fill: $white-light;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.about-gitlab {
|
||||
color: $color-light;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$theme-charcoal-light: #b9bbbe;
|
||||
$theme-charcoal: #485157;
|
||||
$theme-charcoal-dark: #3d454d;
|
||||
$theme-charcoal-darker: #383f45;
|
||||
|
||||
$theme-blue-light: #becde9;
|
||||
$theme-blue: #2980b9;
|
||||
$theme-blue-dark: #1970a9;
|
||||
$theme-blue-darker: #096099;
|
||||
|
||||
$theme-graphite-light: #ccc;
|
||||
$theme-graphite: #777;
|
||||
$theme-graphite-dark: #666;
|
||||
$theme-graphite-darker: #555;
|
||||
|
||||
$theme-black-light: #979797;
|
||||
$theme-black: #373737;
|
||||
$theme-black-dark: #272727;
|
||||
$theme-black-darker: #222;
|
||||
|
||||
$theme-green-light: #adc;
|
||||
$theme-green: #019875;
|
||||
$theme-green-dark: #018865;
|
||||
$theme-green-darker: #017855;
|
||||
|
||||
$theme-violet-light: #98c;
|
||||
$theme-violet: #548;
|
||||
$theme-violet-dark: #436;
|
||||
$theme-violet-darker: #325;
|
||||
|
||||
body {
|
||||
&.ui_blue {
|
||||
@include gitlab-theme($theme-blue-light, $theme-blue, $theme-blue-dark, $theme-blue-darker);
|
||||
}
|
||||
|
||||
&.ui_charcoal {
|
||||
@include gitlab-theme($theme-charcoal-light, $theme-charcoal, $theme-charcoal-dark, $theme-charcoal-darker);
|
||||
}
|
||||
|
||||
&.ui_graphite {
|
||||
@include gitlab-theme($theme-graphite-light, $theme-graphite, $theme-graphite-dark, $theme-graphite-darker);
|
||||
}
|
||||
|
||||
&.ui_black {
|
||||
@include gitlab-theme($theme-black-light, $theme-black, $theme-black-dark, $theme-black-darker);
|
||||
}
|
||||
|
||||
&.ui_green {
|
||||
@include gitlab-theme($theme-green-light, $theme-green, $theme-green-dark, $theme-green-darker);
|
||||
}
|
||||
|
||||
&.ui_violet {
|
||||
@include gitlab-theme($theme-violet-light, $theme-violet, $theme-violet-dark, $theme-violet-darker);
|
||||
}
|
||||
}
|
|
@ -47,73 +47,6 @@
|
|||
}
|
||||
}
|
||||
|
||||
.nav-sidebar {
|
||||
position: absolute;
|
||||
top: 50px;
|
||||
bottom: 0;
|
||||
width: $sidebar_width;
|
||||
overflow-y: auto;
|
||||
overflow-x: hidden;
|
||||
|
||||
&.navbar-collapse {
|
||||
padding: 0 !important;
|
||||
}
|
||||
|
||||
li {
|
||||
&.separate-item {
|
||||
padding-top: 10px;
|
||||
margin-top: 10px;
|
||||
}
|
||||
|
||||
.icon-container {
|
||||
width: 34px;
|
||||
display: inline-block;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
a {
|
||||
padding: 7px $gl-sidebar-padding;
|
||||
font-size: $gl-font-size;
|
||||
line-height: 24px;
|
||||
display: block;
|
||||
text-decoration: none;
|
||||
font-weight: normal;
|
||||
|
||||
&:hover,
|
||||
&:active,
|
||||
&:focus {
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
i {
|
||||
font-size: 16px;
|
||||
}
|
||||
|
||||
i,
|
||||
svg {
|
||||
margin-right: 13px;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.count {
|
||||
float: right;
|
||||
padding: 0 8px;
|
||||
border-radius: 6px;
|
||||
}
|
||||
|
||||
.about-gitlab {
|
||||
padding: 7px $gl-sidebar-padding;
|
||||
font-size: $gl-font-size;
|
||||
line-height: 24px;
|
||||
display: block;
|
||||
text-decoration: none;
|
||||
font-weight: normal;
|
||||
position: absolute;
|
||||
bottom: 10px;
|
||||
}
|
||||
}
|
||||
|
||||
.sidebar-action-buttons {
|
||||
width: $sidebar_width;
|
||||
position: absolute;
|
||||
|
|
|
@ -1,42 +1,3 @@
|
|||
.application-theme {
|
||||
label {
|
||||
margin-right: 20px;
|
||||
text-align: center;
|
||||
|
||||
.preview {
|
||||
border-radius: 4px;
|
||||
|
||||
height: 80px;
|
||||
margin-bottom: 10px;
|
||||
width: 160px;
|
||||
|
||||
&.ui_blue {
|
||||
background: $theme-blue;
|
||||
}
|
||||
|
||||
&.ui_charcoal {
|
||||
background: $theme-charcoal;
|
||||
}
|
||||
|
||||
&.ui_graphite {
|
||||
background: $theme-graphite;
|
||||
}
|
||||
|
||||
&.ui_black {
|
||||
background: $theme-black;
|
||||
}
|
||||
|
||||
&.ui_green {
|
||||
background: $theme-green;
|
||||
}
|
||||
|
||||
&.ui_violet {
|
||||
background: $theme-violet;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.syntax-theme {
|
||||
label {
|
||||
margin-right: 20px;
|
||||
|
|
|
@ -41,10 +41,6 @@ module PreferencesHelper
|
|||
]
|
||||
end
|
||||
|
||||
def user_application_theme
|
||||
Gitlab::Themes.for_user(current_user).css_class
|
||||
end
|
||||
|
||||
def user_color_scheme
|
||||
Gitlab::ColorSchemes.for_user(current_user).css_class
|
||||
end
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
!!! 5
|
||||
%html{ lang: "en", class: "#{page_class}" }
|
||||
= render "layouts/head"
|
||||
%body{ class: "#{user_application_theme}", data: { page: body_data_page, project: "#{@project.path if @project}", group: "#{@group.path if @group}" } }
|
||||
%body{ data: { page: body_data_page, project: "#{@project.path if @project}", group: "#{@group.path if @group}" } }
|
||||
= Gon::Base.render_data
|
||||
|
||||
= render "layouts/header/default", title: header_title
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
%ul.nav
|
||||
%ul
|
||||
= nav_link(path: ['root#index', 'projects#trending', 'projects#starred', 'dashboard/projects#index'], html_options: {class: "#{project_tab_class} home"}) do
|
||||
= link_to dashboard_projects_path, title: 'Projects', class: 'dashboard-shortcuts-projects' do
|
||||
%span
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
%ul.nav.nav-sidebar
|
||||
%ul
|
||||
= nav_link(path: ['dashboard#show', 'root#show', 'projects#trending', 'projects#starred', 'projects#index'], html_options: {class: 'home'}) do
|
||||
= link_to explore_root_path, title: 'Projects' do
|
||||
%span
|
||||
|
|
|
@ -7,12 +7,6 @@
|
|||
Application theme
|
||||
%p
|
||||
This setting allows you to customize the appearance of the site, e.g. the sidebar.
|
||||
.col-lg-9.application-theme
|
||||
- Gitlab::Themes.each do |theme|
|
||||
= label_tag do
|
||||
.preview{ class: theme.css_class }
|
||||
= f.radio_button :theme_id, theme.id
|
||||
= theme.name
|
||||
.col-sm-12
|
||||
%hr
|
||||
.col-lg-3.profile-settings-sidebar
|
||||
|
|
|
@ -1,7 +1,3 @@
|
|||
// Remove body class for any previous theme, re-add current one
|
||||
$('body').removeClass('<%= Gitlab::Themes.body_classes %>')
|
||||
$('body').addClass('<%= user_application_theme %>')
|
||||
|
||||
// Toggle container-fluid class
|
||||
if ('<%= current_user.layout %>' === 'fluid') {
|
||||
$('.content-wrapper .container-fluid').removeClass('container-limited')
|
||||
|
|
|
@ -183,7 +183,6 @@ Settings['gitlab'] ||= Settingslogic.new({})
|
|||
Settings.gitlab['default_projects_limit'] ||= 10
|
||||
Settings.gitlab['default_branch_protection'] ||= 2
|
||||
Settings.gitlab['default_can_create_group'] = true if Settings.gitlab['default_can_create_group'].nil?
|
||||
Settings.gitlab['default_theme'] = Gitlab::Themes::APPLICATION_DEFAULT if Settings.gitlab['default_theme'].nil?
|
||||
Settings.gitlab['host'] ||= ENV['GITLAB_HOST'] || 'localhost'
|
||||
Settings.gitlab['ssh_host'] ||= Settings.gitlab.host
|
||||
Settings.gitlab['https'] = false if Settings.gitlab['https'].nil?
|
||||
|
|
|
@ -1,87 +0,0 @@
|
|||
module Gitlab
|
||||
# Module containing GitLab's application theme definitions and helper methods
|
||||
# for accessing them.
|
||||
module Themes
|
||||
extend self
|
||||
|
||||
# Theme ID used when no `default_theme` configuration setting is provided.
|
||||
APPLICATION_DEFAULT = 2
|
||||
|
||||
# Struct class representing a single Theme
|
||||
Theme = Struct.new(:id, :name, :css_class)
|
||||
|
||||
# All available Themes
|
||||
THEMES = [
|
||||
Theme.new(1, 'Graphite', 'ui_graphite'),
|
||||
Theme.new(2, 'Charcoal', 'ui_charcoal'),
|
||||
Theme.new(3, 'Green', 'ui_green'),
|
||||
Theme.new(4, 'Black', 'ui_black'),
|
||||
Theme.new(5, 'Violet', 'ui_violet'),
|
||||
Theme.new(6, 'Blue', 'ui_blue')
|
||||
].freeze
|
||||
|
||||
# Convenience method to get a space-separated String of all the theme
|
||||
# classes that might be applied to the `body` element
|
||||
#
|
||||
# Returns a String
|
||||
def body_classes
|
||||
THEMES.collect(&:css_class).uniq.join(' ')
|
||||
end
|
||||
|
||||
# Get a Theme by its ID
|
||||
#
|
||||
# If the ID is invalid, returns the default Theme.
|
||||
#
|
||||
# id - Integer ID
|
||||
#
|
||||
# Returns a Theme
|
||||
def by_id(id)
|
||||
THEMES.detect { |t| t.id == id } || default
|
||||
end
|
||||
|
||||
# Returns the number of defined Themes
|
||||
def count
|
||||
THEMES.size
|
||||
end
|
||||
|
||||
# Get the default Theme
|
||||
#
|
||||
# Returns a Theme
|
||||
def default
|
||||
by_id(default_id)
|
||||
end
|
||||
|
||||
# Iterate through each Theme
|
||||
#
|
||||
# Yields the Theme object
|
||||
def each(&block)
|
||||
THEMES.each(&block)
|
||||
end
|
||||
|
||||
# Get the Theme for the specified user, or the default
|
||||
#
|
||||
# user - User record
|
||||
#
|
||||
# Returns a Theme
|
||||
def for_user(user)
|
||||
if user
|
||||
by_id(user.theme_id)
|
||||
else
|
||||
default
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def default_id
|
||||
id = Gitlab.config.gitlab.default_theme.to_i
|
||||
|
||||
# Prevent an invalid configuration setting from causing an infinite loop
|
||||
if id < THEMES.first.id || id > THEMES.last.id
|
||||
APPLICATION_DEFAULT
|
||||
else
|
||||
id
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
|
@ -8,35 +8,6 @@ describe 'Profile > Preferences', feature: true do
|
|||
visit profile_preferences_path
|
||||
end
|
||||
|
||||
describe 'User changes their application theme', js: true do
|
||||
let(:default) { Gitlab::Themes.default }
|
||||
let(:theme) { Gitlab::Themes.by_id(5) }
|
||||
|
||||
it 'creates a flash message' do
|
||||
choose "user_theme_id_#{theme.id}"
|
||||
|
||||
expect_preferences_saved_message
|
||||
end
|
||||
|
||||
it 'updates their preference' do
|
||||
choose "user_theme_id_#{theme.id}"
|
||||
|
||||
allowing_for_delay do
|
||||
visit page.current_path
|
||||
expect(page).to have_checked_field("user_theme_id_#{theme.id}")
|
||||
end
|
||||
end
|
||||
|
||||
it 'reflects the changes immediately' do
|
||||
expect(page).to have_selector("body.#{default.css_class}")
|
||||
|
||||
choose "user_theme_id_#{theme.id}"
|
||||
|
||||
expect(page).not_to have_selector("body.#{default.css_class}")
|
||||
expect(page).to have_selector("body.#{theme.css_class}")
|
||||
end
|
||||
end
|
||||
|
||||
describe 'User changes their syntax highlighting theme', js: true do
|
||||
it 'creates a flash message' do
|
||||
choose 'user_color_scheme_id_5'
|
||||
|
|
|
@ -26,32 +26,6 @@ describe PreferencesHelper do
|
|||
end
|
||||
end
|
||||
|
||||
describe 'user_application_theme' do
|
||||
context 'with a user' do
|
||||
it "returns user's theme's css_class" do
|
||||
stub_user(theme_id: 3)
|
||||
|
||||
expect(helper.user_application_theme).to eq 'ui_green'
|
||||
end
|
||||
|
||||
it 'returns the default when id is invalid' do
|
||||
stub_user(theme_id: Gitlab::Themes.count + 5)
|
||||
|
||||
allow(Gitlab.config.gitlab).to receive(:default_theme).and_return(2)
|
||||
|
||||
expect(helper.user_application_theme).to eq 'ui_charcoal'
|
||||
end
|
||||
end
|
||||
|
||||
context 'without a user' do
|
||||
it 'returns the default theme' do
|
||||
stub_user
|
||||
|
||||
expect(helper.user_application_theme).to eq Gitlab::Themes.default.css_class
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
describe 'user_color_scheme' do
|
||||
context 'with a user' do
|
||||
it "returns user's scheme's css_class" do
|
||||
|
|
|
@ -1,48 +0,0 @@
|
|||
require 'spec_helper'
|
||||
|
||||
describe Gitlab::Themes, lib: true do
|
||||
describe '.body_classes' do
|
||||
it 'returns a space-separated list of class names' do
|
||||
css = described_class.body_classes
|
||||
|
||||
expect(css).to include('ui_graphite')
|
||||
expect(css).to include(' ui_charcoal ')
|
||||
expect(css).to include(' ui_blue')
|
||||
end
|
||||
end
|
||||
|
||||
describe '.by_id' do
|
||||
it 'returns a Theme by its ID' do
|
||||
expect(described_class.by_id(1).name).to eq 'Graphite'
|
||||
expect(described_class.by_id(6).name).to eq 'Blue'
|
||||
end
|
||||
end
|
||||
|
||||
describe '.default' do
|
||||
it 'returns the default application theme' do
|
||||
allow(described_class).to receive(:default_id).and_return(2)
|
||||
expect(described_class.default.id).to eq 2
|
||||
end
|
||||
|
||||
it 'prevents an infinite loop when configuration default is invalid' do
|
||||
default = described_class::APPLICATION_DEFAULT
|
||||
themes = described_class::THEMES
|
||||
|
||||
config = double(default_theme: 0).as_null_object
|
||||
allow(Gitlab).to receive(:config).and_return(config)
|
||||
expect(described_class.default.id).to eq default
|
||||
|
||||
config = double(default_theme: themes.size + 5).as_null_object
|
||||
allow(Gitlab).to receive(:config).and_return(config)
|
||||
expect(described_class.default.id).to eq default
|
||||
end
|
||||
end
|
||||
|
||||
describe '.each' do
|
||||
it 'passes the block to the THEMES Array' do
|
||||
ids = []
|
||||
described_class.each { |theme| ids << theme.id }
|
||||
expect(ids).not_to be_empty
|
||||
end
|
||||
end
|
||||
end
|
Loading…
Reference in a new issue