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
1f1de7f7
Commit
1f1de7f7
authored
Mar 15, 2018
by
Tiago Botelho
Committed by
André Luís
Mar 30, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Ports every change to EE folder
parent
b66a26b6
Changes
12
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
113 additions
and
76 deletions
+113
-76
app/controllers/admin/appearances_controller.rb
app/controllers/admin/appearances_controller.rb
+8
-6
app/helpers/appearances_helper.rb
app/helpers/appearances_helper.rb
+1
-39
app/models/appearance.rb
app/models/appearance.rb
+2
-7
app/views/admin/appearances/_form.html.haml
app/views/admin/appearances/_form.html.haml
+1
-22
app/views/layouts/application.html.haml
app/views/layouts/application.html.haml
+2
-2
ee/app/controllers/ee/admin/appearances_controller.rb
ee/app/controllers/ee/admin/appearances_controller.rb
+20
-0
ee/app/helpers/ee/appearances_helper.rb
ee/app/helpers/ee/appearances_helper.rb
+39
-0
ee/app/models/ee/appearance.rb
ee/app/models/ee/appearance.rb
+16
-0
ee/app/views/admin/appearances/ee/_footer_message.html.haml
ee/app/views/admin/appearances/ee/_footer_message.html.haml
+0
-0
ee/app/views/admin/appearances/ee/_form.html.haml
ee/app/views/admin/appearances/ee/_form.html.haml
+24
-0
ee/app/views/admin/appearances/ee/_header_message.html.haml
ee/app/views/admin/appearances/ee/_header_message.html.haml
+0
-0
ee/db/migrate/20180314145917_add_header_and_footer_banners_to_appearances_table.rb
...917_add_header_and_footer_banners_to_appearances_table.rb
+0
-0
No files found.
app/controllers/admin/appearances_controller.rb
View file @
1f1de7f7
class
Admin::AppearancesController
<
Admin
::
ApplicationController
prepend
EE
::
Admin
::
AppearancesController
before_action
:set_appearance
,
except: :create
def
show
...
...
@@ -50,7 +52,11 @@ class Admin::AppearancesController < Admin::ApplicationController
# Only allow a trusted parameter "white list" through.
def
appearance_params
params
.
require
(
:appearance
).
permit
(
%i(
params
.
require
(
:appearance
).
permit
(
appearance_params_attributes
)
end
def
appearance_params_attributes
%i[
title
description
logo
...
...
@@ -59,10 +65,6 @@ class Admin::AppearancesController < Admin::ApplicationController
header_logo_cache
new_project_guidelines
updated_by
header_message
footer_message
background_color
font_color
)
)
]
end
end
app/helpers/appearances_helper.rb
View file @
1f1de7f7
module
AppearancesHelper
def
header_message
(
appearance
)
return
unless
appearance
.
header_message
.
present?
appearance_message
(
appearance
,
:header_message
)
end
def
footer_message
(
appearance
)
return
unless
appearance
.
footer_message
.
present?
appearance_message
(
appearance
,
:footer_message
)
end
def
appearance_message
(
appearance
,
field_sym
)
class_names
=
[
field_sym
.
to_s
.
dasherize
]
class_names
<<
'with-performance-bar'
if
performance_bar_enabled?
content_tag
:div
,
class:
class_names
,
style:
message_style
(
appearance
)
do
icon
(
'bullhorn'
)
<<
' '
<<
render_message
(
appearance
,
field_sym
)
end
end
def
message_style
(
appearance
)
style
=
''
if
appearance
.
background_color
.
present?
style
<<
"background-color:
#{
appearance
.
background_color
}
"
style
<<
'; '
if
appearance
.
font_color
.
present?
end
if
appearance
.
font_color
.
present?
style
<<
"color:
#{
appearance
.
font_color
}
"
end
style
end
def
render_message
(
appearance
,
field
)
Banzai
.
render_field
(
appearance
,
field
).
html_safe
end
prepend
EE
::
AppearancesHelper
def
brand_title
brand_item
&
.
title
.
presence
||
'GitLab Enterprise Edition'
...
...
app/models/appearance.rb
View file @
1f1de7f7
...
...
@@ -3,21 +3,16 @@ class Appearance < ActiveRecord::Base
include
AfterCommitQueue
include
ObjectStorage
::
BackgroundMove
prepend
EE
::
Appearance
cache_markdown_field
:description
cache_markdown_field
:new_project_guidelines
cache_markdown_field
:header_message
cache_markdown_field
:footer_message
validates
:background_color
,
allow_blank:
true
,
color:
true
validates
:font_color
,
allow_blank:
true
,
color:
true
validates
:logo
,
file_size:
{
maximum:
1
.
megabyte
}
validates
:header_logo
,
file_size:
{
maximum:
1
.
megabyte
}
validate
:single_appearance_row
,
on: :create
default_value_for
:background_color
,
'#E75E40'
default_value_for
:font_color
,
'#FFFFFF'
mount_uploader
:logo
,
AttachmentUploader
mount_uploader
:header_logo
,
AttachmentUploader
...
...
app/views/admin/appearances/_form.html.haml
View file @
1f1de7f7
...
...
@@ -18,28 +18,7 @@
.hint
Maximum file size is 1MB. Pages are optimized for a 28px tall header logo
%fieldset
.system_header_footer
%legend
System header and footer:
.form-group
=
f
.
label
:header_message
,
'Header message'
,
class:
'control-label'
.col-sm-10
=
f
.
text_area
:header_message
,
placeholder:
'State your message to activate'
,
class:
"form-control js-autosize"
.form-group
=
f
.
label
:footer_message
,
'Footer message'
,
class:
'control-label'
.col-sm-10
=
f
.
text_area
:footer_message
,
placeholder:
'State your message to activate'
,
class:
"form-control js-autosize"
.form-group.js-toggle-colors-container
.col-sm-10.col-sm-offset-2
=
link_to
'Customize colors'
,
'#'
,
class:
'js-toggle-colors-link'
.form-group.js-toggle-colors-container.hide
=
f
.
label
:background_color
,
"Background Color"
,
class:
'control-label'
.col-sm-10
=
f
.
color_field
:background_color
,
class:
"form-control"
.form-group.js-toggle-colors-container.hide
=
f
.
label
:font_color
,
"Font Color"
,
class:
'control-label'
.col-sm-10
=
f
.
color_field
:font_color
,
class:
"form-control"
=
render
partial:
'admin/appearances/ee/form'
,
locals:
{
form:
f
}
%fieldset
.sign-in
%legend
...
...
app/views/layouts/application.html.haml
View file @
1f1de7f7
...
...
@@ -4,9 +4,9 @@
%body
{
class:
"#{user_application_theme} #{@body_class}"
,
data:
{
page:
body_data_page
,
project:
"#{@project.path if @project}"
,
group:
"#{@group.path if @group}"
,
find_file:
find_file_path
}
}
=
render
"layouts/init_auto_complete"
if
@gfm_form
=
render
'peek/bar'
=
render
"
layouts
/header_message"
=
render
"
admin/appearances/ee
/header_message"
=
render
"layouts/header/default"
=
render
'layouts/page'
,
sidebar:
sidebar
,
nav:
nav
=
render
"
layouts
/footer_message"
=
render
"
admin/appearances/ee
/footer_message"
=
yield
:scripts_body
ee/app/controllers/ee/admin/appearances_controller.rb
0 → 100644
View file @
1f1de7f7
module
EE
module
Admin
module
AppearancesController
def
appearance_params_attributes
super
+
appearance_params_ee
end
private
def
appearance_params_ee
%i[
header_message
footer_message
background_color
font_color
]
end
end
end
end
ee/app/helpers/ee/appearances_helper.rb
0 → 100644
View file @
1f1de7f7
module
EE
module
AppearancesHelper
def
header_message
(
appearance
)
return
unless
appearance
&
.
header_message
.
present?
class_names
=
[]
class_names
<<
'with-performance-bar'
if
performance_bar_enabled?
appearance_message
(
appearance
,
:header_message
,
class_names
)
end
def
footer_message
(
appearance
)
return
unless
appearance
&
.
footer_message
.
present?
appearance_message
(
appearance
,
:footer_message
)
end
private
def
appearance_message
(
appearance
,
field_sym
,
class_names
=
[])
class_names
<<
field_sym
.
to_s
.
dasherize
content_tag
:div
,
class:
class_names
,
style:
message_style
(
appearance
)
do
render_message
(
appearance
,
field_sym
)
end
end
def
message_style
(
appearance
)
style
=
''
style
<<
"background-color:
#{
appearance
.
background_color
}
;"
style
<<
"color:
#{
appearance
.
font_color
}
"
style
end
def
render_message
(
appearance
,
field
)
::
Banzai
.
render_field
(
appearance
,
field
).
html_safe
end
end
end
ee/app/models/ee/appearance.rb
0 → 100644
View file @
1f1de7f7
module
EE
module
Appearance
extend
ActiveSupport
::
Concern
prepended
do
cache_markdown_field
:header_message
cache_markdown_field
:footer_message
validates
:background_color
,
allow_blank:
true
,
color:
true
validates
:font_color
,
allow_blank:
true
,
color:
true
default_value_for
:background_color
,
'#E75E40'
default_value_for
:font_color
,
'#FFFFFF'
end
end
end
app/views/layouts
/_footer_message.html.haml
→
ee/app/views/admin/appearances/ee
/_footer_message.html.haml
View file @
1f1de7f7
File moved
ee/app/views/admin/appearances/ee/_form.html.haml
0 → 100644
View file @
1f1de7f7
-
form
=
local_assigns
.
fetch
(
:form
)
%fieldset
.system_header_footer
%legend
System header and footer:
.form-group
=
form
.
label
:header_message
,
'Header message'
,
class:
'control-label'
.col-sm-10
=
form
.
text_area
:header_message
,
placeholder:
'State your message to activate'
,
class:
"form-control js-autosize"
.form-group
=
form
.
label
:footer_message
,
'Footer message'
,
class:
'control-label'
.col-sm-10
=
form
.
text_area
:footer_message
,
placeholder:
'State your message to activate'
,
class:
"form-control js-autosize"
.form-group.js-toggle-colors-container
.col-sm-10.col-sm-offset-2
=
link_to
'Customize colors'
,
'#'
,
class:
'js-toggle-colors-link'
.form-group.js-toggle-colors-container.hide
=
form
.
label
:background_color
,
"Background Color"
,
class:
'control-label'
.col-sm-10
=
form
.
color_field
:background_color
,
class:
"form-control"
.form-group.js-toggle-colors-container.hide
=
form
.
label
:font_color
,
"Font Color"
,
class:
'control-label'
.col-sm-10
=
form
.
color_field
:font_color
,
class:
"form-control"
app/views/layouts
/_header_message.html.haml
→
ee/app/views/admin/appearances/ee
/_header_message.html.haml
View file @
1f1de7f7
File moved
db/migrate/20180314145917_add_header_and_footer_banners_to_appearances_table.rb
→
ee/
db/migrate/20180314145917_add_header_and_footer_banners_to_appearances_table.rb
View file @
1f1de7f7
File moved
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