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
0
Merge Requests
0
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
Boxiang Sun
gitlab-ce
Commits
0df104a3
Commit
0df104a3
authored
Feb 07, 2017
by
Alexis Reigel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
use custom brand logo in pipeline mails
parent
f0766fde
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
47 additions
and
1 deletion
+47
-1
app/helpers/emails_helper.rb
app/helpers/emails_helper.rb
+14
-0
app/views/layouts/mailer.html.haml
app/views/layouts/mailer.html.haml
+1
-1
spec/helpers/emails_helper_spec.rb
spec/helpers/emails_helper_spec.rb
+32
-0
No files found.
app/helpers/emails_helper.rb
View file @
0df104a3
module
EmailsHelper
include
AppearancesHelper
# Google Actions
# https://developers.google.com/gmail/markup/reference/go-to-action
def
email_action
(
url
)
...
...
@@ -49,4 +51,16 @@ module EmailsHelper
msg
=
"This link is valid for
#{
password_reset_token_valid_time
}
. "
msg
<<
"After it expires, you can
#{
link_tag
}
."
end
def
header_logo
if
brand_item
&&
brand_item
.
header_logo?
brand_header_logo
else
image_tag
(
image_url
(
'mailers/gitlab_header_logo.gif'
),
size:
"55x50"
,
alt:
"GitLab"
)
end
end
end
app/views/layouts/mailer.html.haml
View file @
0df104a3
...
...
@@ -48,7 +48,7 @@
%td
{
style:
"font-family:'Helvetica Neue',Helvetica,Arial,sans-serif;background-color:#6b4fbb;height:4px;font-size:4px;line-height:4px;"
}
%tr
.header
%td
{
style:
"font-family:'Helvetica Neue',Helvetica,Arial,sans-serif;padding:25px 0;font-size:13px;line-height:1.6;color:#5c5c5c;"
}
%img
{
alt:
"GitLab"
,
height:
"50"
,
src:
image_url
(
'mailers/gitlab_header_logo.gif'
),
width:
"55"
}
/
=
header_logo
%tr
%td
{
style:
"font-family:'Helvetica Neue',Helvetica,Arial,sans-serif;"
}
%table
.wrapper
{
border:
"0"
,
cellpadding:
"0"
,
cellspacing:
"0"
,
style:
"width:640px;margin:0 auto;border-collapse:separate;border-spacing:0;"
}
...
...
spec/helpers/emails_helper_spec.rb
View file @
0df104a3
...
...
@@ -43,4 +43,36 @@ describe EmailsHelper do
end
end
end
describe
'#header_logo'
do
context
'there is a brand item with a logo'
do
it
'returns the brand header logo'
do
appearance
=
create
:appearance
,
header_logo:
fixture_file_upload
(
Rails
.
root
.
join
(
'spec/fixtures/dk.png'
)
)
expect
(
header_logo
).
to
eq
(
%{<img src="/uploads/appearance/header_logo/#{appearance.id}/dk.png" alt="Dk" />}
)
end
end
context
'there is a brand item without a logo'
do
it
'returns the default header logo'
do
create
:appearance
,
header_logo:
nil
expect
(
header_logo
).
to
eq
(
%{<img alt="GitLab" src="/images/mailers/gitlab_header_logo.gif" width="55" height="50" />}
)
end
end
context
'there is no brand item'
do
it
'returns the default header logo'
do
expect
(
header_logo
).
to
eq
(
%{<img alt="GitLab" src="/images/mailers/gitlab_header_logo.gif" width="55" height="50" />}
)
end
end
end
end
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