From ef7b32a8541fa49aaa3f668e90216f83bb9efbbf Mon Sep 17 00:00:00 2001 From: Robert Speicher Date: Tue, 9 Oct 2012 14:07:44 -0400 Subject: [PATCH 1/6] Don't show a project name in the page title on Dashboard pages The `@project` instance variable was bubbling up to the ``. --- app/views/dashboard/issues.html.haml | 4 ++-- app/views/dashboard/merge_requests.html.haml | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/app/views/dashboard/issues.html.haml b/app/views/dashboard/issues.html.haml index cc488d57e9e..131928d056b 100644 --- a/app/views/dashboard/issues.html.haml +++ b/app/views/dashboard/issues.html.haml @@ -8,8 +8,8 @@ - if @issues.any? - @issues.group_by(&:project).each do |group| %div.ui-box - - @project = group[0] - %h5= @project.name + - project = group[0] + %h5= project.name %ul.unstyled.issues_table - group[1].each do |issue| = render(partial: 'issues/show', locals: {issue: issue}) diff --git a/app/views/dashboard/merge_requests.html.haml b/app/views/dashboard/merge_requests.html.haml index 23a7e7222d7..030374500fa 100644 --- a/app/views/dashboard/merge_requests.html.haml +++ b/app/views/dashboard/merge_requests.html.haml @@ -7,8 +7,8 @@ - if @merge_requests.any? - @merge_requests.group_by(&:project).each do |group| %ul.unstyled.ui-box - - @project = group[0] - %h5= @project.name + - project = group[0] + %h5= project.name - group[1].each do |merge_request| = render(partial: 'merge_requests/merge_request', locals: {merge_request: merge_request}) %hr -- GitLab From 60c3119ebb061a1a5fce292d00f5b39e1b75b91b Mon Sep 17 00:00:00 2001 From: Robert Speicher <rspeicher@gmail.com> Date: Tue, 9 Oct 2012 14:55:10 -0400 Subject: [PATCH 2/6] Update the CSS for the header "vertical divider" Separates the spacing CSS from the "bar" CSS, so it can be hidden without losing the padding. --- app/assets/stylesheets/sections/header.scss | 24 ++++++++++++-------- app/assets/stylesheets/themes/ui_mars.scss | 10 +++++--- app/assets/stylesheets/themes/ui_modern.scss | 16 +++++++------ app/views/layouts/_head_panel.html.haml | 6 ++--- 4 files changed, 34 insertions(+), 22 deletions(-) diff --git a/app/assets/stylesheets/sections/header.scss b/app/assets/stylesheets/sections/header.scss index 8328a5ab9a7..a280a91012e 100644 --- a/app/assets/stylesheets/sections/header.scss +++ b/app/assets/stylesheets/sections/header.scss @@ -22,7 +22,6 @@ header { * */ .app_logo { - width:200px; float:left; position:relative; top:-5px; @@ -31,7 +30,7 @@ header { h1 { padding-top: 5px; - width:90px; + width:auto; background: url('logo_dark.png') no-repeat 0px -3px; float:left; margin-left:5px; @@ -43,19 +42,26 @@ header { padding-left:50px; height:40px; font-family: 'Korolev', sans-serif; + text-transform: uppercase; } } - .separator { - margin-left:20px; - float: left; - height: 60px; - width: 1px; - background: white; + } + + // Spacing between logo and header title + .separator { + float: left; + line-height: 60px; + margin: -15px 15px 0 15px; + + // Visible "Bar" inside the separator + .vertical-bar { border-left: 1px solid #DDD; - margin-top: -10px; + border-right: 1px solid #FFF; + height: 60px; } } + .container { .top_panel_content { margin:auto; diff --git a/app/assets/stylesheets/themes/ui_mars.scss b/app/assets/stylesheets/themes/ui_mars.scss index c630f388945..6423dfc19f3 100644 --- a/app/assets/stylesheets/themes/ui_mars.scss +++ b/app/assets/stylesheets/themes/ui_mars.scss @@ -64,6 +64,7 @@ .search-input::-webkit-input-placeholder { color: #666; } + .app_logo { a { h1 { @@ -72,11 +73,14 @@ text-shadow: 0 1px 1px #111; } } - .separator { - display:none; - } + } + .separator { + .vertical-bar { + border: none; + } } + .project_name { color:#fff; text-shadow: 0 1px 1px #111; diff --git a/app/assets/stylesheets/themes/ui_modern.scss b/app/assets/stylesheets/themes/ui_modern.scss index 1f0d795562b..d20f5771c13 100644 --- a/app/assets/stylesheets/themes/ui_modern.scss +++ b/app/assets/stylesheets/themes/ui_modern.scss @@ -37,7 +37,6 @@ * */ .app_logo { - width:160px; a { h1 { background: none; @@ -47,13 +46,16 @@ padding-left: 0; } } - .separator { - width: 1px; - height: 40px; - margin: 0 10px; - overflow: hidden; - background: #222; + } + + .separator { + line-height: 40px; + margin-top: -5px; + + .vertical-bar { border-left: 1px solid #333; + border-right: 1px solid #222; + height: 40px; } } diff --git a/app/views/layouts/_head_panel.html.haml b/app/views/layouts/_head_panel.html.haml index f5e423a5abf..6f127eef786 100644 --- a/app/views/layouts/_head_panel.html.haml +++ b/app/views/layouts/_head_panel.html.haml @@ -4,9 +4,9 @@ .top_panel_content %div.app_logo = link_to root_path, class: "home", title: "Home" do - %h1 - GITLAB - %span.separator + %h1 GitLab + %div.separator + %div.vertical-bar %h1.project_name= title .search = form_tag search_path, method: :get do |f| -- GitLab From 72ae0b0a865ce40bd2826d07d3bfe2e4f10eda60 Mon Sep 17 00:00:00 2001 From: Robert Speicher <rspeicher@gmail.com> Date: Tue, 9 Oct 2012 15:40:09 -0400 Subject: [PATCH 3/6] Alphabetize .gitignore --- .gitignore | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/.gitignore b/.gitignore index d22760e7780..b8d881147ab 100644 --- a/.gitignore +++ b/.gitignore @@ -1,25 +1,25 @@ +*.swp +.DS_Store .bundle +.chef +.directory +.idea +.rbenv-version .rbx/ -db/*.sqlite3 -db/*.sqlite3-journal -log/*.log -tmp/ -.sass-cache/ -coverage/* -backups/* -*.swp -public/uploads/ .rvmrc -.rbenv-version -.directory -nohup.out -Vagrantfile +.sass-cache/ .vagrant -config/gitlab.yml +Vagrantfile +backups/* config/database.yml +config/gitlab.yml config/initializers/omniauth.rb config/unicorn.rb +coverage/* +db/*.sqlite3 +db/*.sqlite3-journal db/data.yml -.idea -.DS_Store -.chef +log/*.log +nohup.out +public/uploads/ +tmp/ -- GitLab From 050f9088f7e920e62ee934be74096c7e8bcd2547 Mon Sep 17 00:00:00 2001 From: Robert Speicher <rspeicher@gmail.com> Date: Tue, 9 Oct 2012 15:41:03 -0400 Subject: [PATCH 4/6] Add an 'overrides' SCSS file This file is intentionally empty and ignored by Git, to allow a user to make CSS customizations without them being wiped out by a Git pull or another developer. --- .gitignore | 1 + app/assets/stylesheets/application.css | 2 +- app/assets/stylesheets/overrides.scss | 11 +++++++++++ 3 files changed, 13 insertions(+), 1 deletion(-) create mode 100644 app/assets/stylesheets/overrides.scss diff --git a/.gitignore b/.gitignore index b8d881147ab..e678713dfc6 100644 --- a/.gitignore +++ b/.gitignore @@ -10,6 +10,7 @@ .sass-cache/ .vagrant Vagrantfile +app/assets/stylesheets/overrides.scss backups/* config/database.yml config/gitlab.yml diff --git a/app/assets/stylesheets/application.css b/app/assets/stylesheets/application.css index 424ba71f7cb..88ee5678a40 100644 --- a/app/assets/stylesheets/application.css +++ b/app/assets/stylesheets/application.css @@ -6,6 +6,6 @@ *= require jquery.ui.aristo *= require jquery.atwho *= require chosen - *= require_self *= require main + *= require overrides */ diff --git a/app/assets/stylesheets/overrides.scss b/app/assets/stylesheets/overrides.scss new file mode 100644 index 00000000000..fc472d83d90 --- /dev/null +++ b/app/assets/stylesheets/overrides.scss @@ -0,0 +1,11 @@ +// Place here any custom CSS overrides you want to make. +// +// For example, to customize the logo across all themes: +// +// .ui_basic, .ui_mars, .ui_modern { +// .app_logo { +// h1 { +// background: url('http://assets.example.com/images/logo.png') no-repeat 0px -3px; +// } +// } +// } -- GitLab From 386b1e36cb15fec0b2e6256a2c67ebe69b000f67 Mon Sep 17 00:00:00 2001 From: Robert Speicher <rspeicher@gmail.com> Date: Tue, 9 Oct 2012 15:46:08 -0400 Subject: [PATCH 5/6] Move the page's title to a helper --- app/helpers/application_helper.rb | 15 +++++++++++++++ app/views/layouts/_head.html.haml | 4 +--- spec/helpers/application_helper_spec.rb | 17 +++++++++++++++++ 3 files changed, 33 insertions(+), 3 deletions(-) diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 911b46c9a30..6aab679619f 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -30,6 +30,21 @@ module ApplicationHelper args.any? { |v| v.to_s.downcase == action_name } end + # Returns a title to be used in the page's <title> element + # + # Automatically appends a project's name if @project is set. + # + # Calls `custom_page_title` if it's defined, allowing customization + def page_title + if defined?(custom_page_title) + custom_page_title + else + title = "GitLab" + title += " > #{@project.name}" if @project && @project.persisted? + title + end + end + def gravatar_icon(user_email = '', size = 40) if Gitlab.config.disable_gravatar? || user_email.blank? 'no_avatar.png' diff --git a/app/views/layouts/_head.html.haml b/app/views/layouts/_head.html.haml index 25fe9d806bc..ff72e304939 100644 --- a/app/views/layouts/_head.html.haml +++ b/app/views/layouts/_head.html.haml @@ -1,8 +1,6 @@ %head %meta{charset: "utf-8"} - %title - GitLab - = " > #{@project.name}" if @project && !@project.new_record? + %title= page_title = favicon_link_tag 'favicon.ico' = stylesheet_link_tag "application" = javascript_include_tag "application" diff --git a/spec/helpers/application_helper_spec.rb b/spec/helpers/application_helper_spec.rb index a94d5505a91..939e7cc5f9e 100644 --- a/spec/helpers/application_helper_spec.rb +++ b/spec/helpers/application_helper_spec.rb @@ -39,6 +39,23 @@ describe ApplicationHelper do end end + describe 'page_title' do + it "returns 'GitLab'" do + page_title.should == "GitLab" + end + + it "includes a project's name when @project is set" do + @project = double(name: 'Project Name', persisted?: true) + page_title.should match(/ > Project Name/) + end + + it "calls custom_page_title if it's defined" do + def custom_page_title; "Custom Title"; end + + page_title.should == "Custom Title" + end + end + describe "gravatar_icon" do let(:user_email) { 'user@email.com' } -- GitLab From 0920915e4d48bffefcf1b16481e0a4ad15bd10e0 Mon Sep 17 00:00:00 2001 From: Robert Speicher <rspeicher@gmail.com> Date: Tue, 9 Oct 2012 15:46:28 -0400 Subject: [PATCH 6/6] Move the header title to a helper --- app/helpers/application_helper.rb | 11 +++++++++++ app/views/layouts/_head_panel.html.haml | 3 +-- spec/helpers/application_helper_spec.rb | 16 ++++++++++++++++ 3 files changed, 28 insertions(+), 2 deletions(-) diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 6aab679619f..6aef49aa6ab 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -30,6 +30,17 @@ module ApplicationHelper args.any? { |v| v.to_s.downcase == action_name } end + # Returns an H1 element to be used in the page's logo section + # + # Calls `custom_application_title` if it's defined, allowing customization + def application_title + if defined?(custom_application_title) + custom_application_title + else + content_tag(:h1, "GitLab") + end + end + # Returns a title to be used in the page's <title> element # # Automatically appends a project's name if @project is set. diff --git a/app/views/layouts/_head_panel.html.haml b/app/views/layouts/_head_panel.html.haml index 6f127eef786..daba03654b6 100644 --- a/app/views/layouts/_head_panel.html.haml +++ b/app/views/layouts/_head_panel.html.haml @@ -3,8 +3,7 @@ .container .top_panel_content %div.app_logo - = link_to root_path, class: "home", title: "Home" do - %h1 GitLab + = link_to application_title, root_path, class: "home", title: "Home" %div.separator %div.vertical-bar %h1.project_name= title diff --git a/spec/helpers/application_helper_spec.rb b/spec/helpers/application_helper_spec.rb index 939e7cc5f9e..b890fc7ed54 100644 --- a/spec/helpers/application_helper_spec.rb +++ b/spec/helpers/application_helper_spec.rb @@ -39,6 +39,22 @@ describe ApplicationHelper do end end + describe 'application_title' do + it "returns an H1 element" do + application_title.should match(/<h1>/) + end + + it "returns 'GitLab'" do + application_title.should match(/GitLab/) + end + + it "calls custom_application_title if it's defined" do + def custom_application_title; "Custom Title"; end + + application_title.should == "Custom Title" + end + end + describe 'page_title' do it "returns 'GitLab'" do page_title.should == "GitLab" -- GitLab