Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
84df1bb4
Commit
84df1bb4
authored
Dec 29, 2014
by
Drew Blessing
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Custom header logo
parent
bdac5ddd
Changes
15
Show whitespace changes
Inline
Side-by-side
Showing
15 changed files
with
116 additions
and
5 deletions
+116
-5
CHANGELOG-EE
CHANGELOG-EE
+3
-0
app/assets/stylesheets/sections/appearances.scss
app/assets/stylesheets/sections/appearances.scss
+8
-0
app/controllers/admin/appearances_controller.rb
app/controllers/admin/appearances_controller.rb
+12
-1
app/helpers/appearances_helper.rb
app/helpers/appearances_helper.rb
+15
-0
app/models/appearance.rb
app/models/appearance.rb
+10
-0
app/views/admin/appearances/_form.html.haml
app/views/admin/appearances/_form.html.haml
+27
-0
app/views/admin/appearances/show.html.haml
app/views/admin/appearances/show.html.haml
+1
-3
app/views/layouts/_head_panel.html.haml
app/views/layouts/_head_panel.html.haml
+1
-0
config/routes.rb
config/routes.rb
+1
-0
db/migrate/20141213212220_add_header_logos_to_appearances.rb
db/migrate/20141213212220_add_header_logos_to_appearances.rb
+6
-0
db/schema.rb
db/schema.rb
+3
-1
features/admin/appearance.feature
features/admin/appearance.feature
+9
-0
features/steps/admin/appearance.rb
features/steps/admin/appearance.rb
+20
-0
public/header_logo_dark.png
public/header_logo_dark.png
+0
-0
public/header_logo_light.png
public/header_logo_light.png
+0
-0
No files found.
CHANGELOG-EE
View file @
84df1bb4
v 7.7.0
- Added custom header logo support (Drew Blessing)
v 7.6.2
- Fix failing migrations for MySQL, LDAP
...
...
app/assets/stylesheets/sections/appearances.scss
View file @
84df1bb4
...
...
@@ -2,3 +2,11 @@
max-width
:
400px
;
margin-bottom
:
20px
;
}
.appearance-dark-logo-preview
{
background-color
:
#F1F1F1
;
}
.appearance-light-logo-preview
{
background-color
:
#373737
;
}
app/controllers/admin/appearances_controller.rb
View file @
84df1bb4
...
...
@@ -34,6 +34,16 @@ class Admin::AppearancesController < Admin::ApplicationController
redirect_to
admin_appearances_path
,
notice:
'Logo was succesfully removed.'
end
def
header_logos
appearance
=
Appearance
.
last
appearance
.
remove_light_logo!
appearance
.
remove_dark_logo!
appearance
.
save
redirect_to
admin_appearances_path
,
notice:
'Header logos were succesfully removed.'
end
private
# Use callbacks to share common setup or constraints between actions.
...
...
@@ -43,6 +53,7 @@ class Admin::AppearancesController < Admin::ApplicationController
# Only allow a trusted parameter "white list" through.
def
appearance_params
params
.
require
(
:appearance
).
permit
(
:title
,
:description
,
:logo
,
:updated_by
)
params
.
require
(
:appearance
).
permit
(
:title
,
:description
,
:logo
,
:dark_logo
,
:light_logo
,
:updated_by
)
end
end
app/helpers/appearances_helper.rb
View file @
84df1bb4
...
...
@@ -15,6 +15,21 @@ module AppearancesHelper
end
end
def
brand_header_logo
if
brand_item
.
header_logos?
haml_tag
(
:style
)
do
# Dark theme/light logo
haml_concat
".dark_theme .app_logo a h1 {"
\
"background: url('
#{
brand_item
.
light_logo
}
') "
\
"no-repeat center center !important; }"
# Light theme/dark logo
haml_concat
".light_theme .app_logo a h1 {"
\
"background: url('
#{
brand_item
.
dark_logo
}
') "
\
"no-repeat center center !important; }"
end
end
end
def
brand_text
markdown
(
brand_item
.
description
)
end
...
...
app/models/appearance.rb
View file @
84df1bb4
...
...
@@ -2,6 +2,16 @@ class Appearance < ActiveRecord::Base
validates
:title
,
presence:
true
validates
:description
,
presence:
true
validates
:logo
,
file_size:
{
maximum:
1000
.
kilobytes
.
to_i
}
validates
:dark_logo
,
file_size:
{
maximum:
1000
.
kilobytes
.
to_i
},
presence:
true
,
if: :light_logo?
validates
:light_logo
,
file_size:
{
maximum:
1000
.
kilobytes
.
to_i
},
presence:
true
,
if: :dark_logo?
mount_uploader
:logo
,
AttachmentUploader
mount_uploader
:dark_logo
,
AttachmentUploader
mount_uploader
:light_logo
,
AttachmentUploader
def
header_logos?
dark_logo?
&&
light_logo?
end
end
app/views/admin/appearances/_form.html.haml
View file @
84df1bb4
...
...
@@ -4,6 +4,9 @@
-
@appearance
.
errors
.
full_messages
.
each
do
|
msg
|
%p
=
msg
%fieldset
.sign-in
%legend
Sign in/Sign up pages:
.form-group
=
f
.
label
:title
,
class:
'control-label'
.col-sm-10
...
...
@@ -25,6 +28,30 @@
=
f
.
file_field
:logo
,
class:
""
.hint
Maximum logo size is 1MB, page optimized for logo size 640x360px
%fieldset
.app_logo
%legend
Navigation bar:
.form-group
=
f
.
label
:dark_logo
,
class:
'control-label'
.col-sm-10
-
if
@appearance
.
dark_logo?
=
image_tag
@appearance
.
dark_logo
,
class:
'appearance-dark-logo-preview'
=
f
.
file_field
:dark_logo
,
class:
""
.hint
Maximum size is 1MB, page optimized for logo size 40x40px
=
f
.
label
:light_logo
,
class:
'control-label'
.col-sm-10
-
if
@appearance
.
light_logo?
=
image_tag
@appearance
.
light_logo
,
class:
'appearance-light-logo-preview'
=
f
.
file_field
:light_logo
,
class:
""
.hint
Maximum size is 1MB, page optimized for logo size 41x41px
-
if
@appearance
.
light_logo?
||
@appearance
.
dark_logo?
%br
=
link_to
'Remove header logos'
,
header_logos_admin_appearances_path
,
data:
{
confirm:
"Header logos will be removed. Are you sure?"
},
method: :delete
,
class:
"btn btn-remove btn-small remove-logo"
.form-actions
=
f
.
submit
'Save'
,
class:
'btn btn-save'
=
link_to
'Preview'
,
preview_admin_appearances_path
,
class:
'btn'
,
target:
'_blank'
...
...
app/views/admin/appearances/show.html.haml
View file @
84df1bb4
%h3
.page-title
Appearance settings
%p
.light
You can modify look of sign-in and sign-up pages here
%hr
You can modify the look and feel of GitLab here
=
render
'form'
app/views/layouts/_head_panel.html.haml
View file @
84df1bb4
...
...
@@ -2,6 +2,7 @@
.navbar-inner
.container
%div
.app_logo
-
brand_header_logo
if
brand_item
=
link_to
root_path
,
class:
"home has_bottom_tooltip"
,
title:
"Dashboard"
do
%h1
GITLAB
%h1
.title
=
title
...
...
config/routes.rb
View file @
84df1bb4
...
...
@@ -114,6 +114,7 @@ Gitlab::Application.routes.draw do
member
do
get
:preview
delete
:logo
delete
:header_logos
end
end
...
...
db/migrate/20141213212220_add_header_logos_to_appearances.rb
0 → 100644
View file @
84df1bb4
class
AddHeaderLogosToAppearances
<
ActiveRecord
::
Migration
def
change
add_column
:appearances
,
:dark_logo
,
:string
add_column
:appearances
,
:light_logo
,
:string
end
end
db/schema.rb
View file @
84df1bb4
...
...
@@ -23,6 +23,8 @@ ActiveRecord::Schema.define(version: 20141217125223) do
t
.
integer
"updated_by"
t
.
datetime
"created_at"
t
.
datetime
"updated_at"
t
.
string
"dark_logo"
t
.
string
"light_logo"
end
create_table
"audit_events"
,
force:
true
do
|
t
|
...
...
@@ -369,8 +371,8 @@ ActiveRecord::Schema.define(version: 20141217125223) do
t
.
boolean
"archived"
,
default:
false
,
null:
false
t
.
string
"import_status"
t
.
float
"repository_size"
,
default:
0.0
t
.
text
"merge_requests_template"
t
.
integer
"star_count"
,
default:
0
,
null:
false
t
.
text
"merge_requests_template"
t
.
boolean
"merge_requests_rebase_enabled"
,
default:
false
end
...
...
features/admin/appearance.feature
View file @
84df1bb4
...
...
@@ -26,3 +26,12 @@ Feature: Admin Appearance
Then
I should see a logo
And
I remove the logo
Then
I should see logo removed
Scenario
:
Header logos
Given
application has custom appearance
And
I sign in as an admin
And
I visit admin appearance page
When
I attach header logos
Then
I should see header logos
And
I remove the header logos
Then
I should see header logos removed
features/steps/admin/appearance.rb
View file @
84df1bb4
...
...
@@ -37,18 +37,38 @@ class Spinach::Features::AdminAppearance < Spinach::FeatureSteps
click_button
'Save'
end
step
'I attach header logos'
do
attach_file
(
:appearance_light_logo
,
File
.
join
(
Rails
.
root
,
'public'
,
'header_logo_light.png'
))
attach_file
(
:appearance_dark_logo
,
File
.
join
(
Rails
.
root
,
'public'
,
'header_logo_dark.png'
))
click_button
'Save'
end
step
'I should see a logo'
do
page
.
should
have_xpath
(
'//img[@src="/uploads/appearance/logo/1/gitlab_logo.png"]'
)
end
step
'I should see header logos'
do
page
.
should
have_xpath
(
'//img[@src="/uploads/appearance/light_logo/1/header_logo_light.png"]'
)
page
.
should
have_xpath
(
'//img[@src="/uploads/appearance/dark_logo/1/header_logo_dark.png"]'
)
end
step
'I remove the logo'
do
click_link
'Remove logo'
end
step
'I remove the header logos'
do
click_link
'Remove header logos'
end
step
'I should see logo removed'
do
page
.
should_not
have_xpath
(
'//img[@src="/uploads/appearance/logo/1/gitlab_logo.png"]'
)
end
step
'I should see header logos removed'
do
page
.
should_not
have_xpath
(
'//img[@src="/uploads/appearance/light_logo/1/header_logo_light.png"]'
)
page
.
should_not
have_xpath
(
'//img[@src="/uploads/appearance/dark_logo/1/header_logo_dark.png"]'
)
end
def
appearance
Appearance
.
last
end
...
...
public/header_logo_dark.png
0 → 100644
View file @
84df1bb4
2.73 KB
public/header_logo_light.png
0 → 100644
View file @
84df1bb4
7.33 KB
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment