notifications: restyling email templates #4087

This commit is contained in:
lisaq 2016-07-28 14:12:37 +02:00
parent 391379c4ab
commit b8c9f0a998
8 changed files with 190 additions and 120 deletions

View file

@ -3,15 +3,100 @@
## headers we additionally can set for email
<%def name="headers()" filter="n,trim"></%def>
## plain text version of the email. Empty by default
<%def name="plaintext_footer()">
${_('This is a notification from RhodeCode. %(instance_url)s') % {'instance_url': instance_url}}
</%def>
<%def name="body_plaintext()" filter="n,trim"></%def>
${self.body()}
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
<title>${self.subject()}</title>
<style type="text/css">
/* Based on The MailChimp Reset INLINE: Yes. */
#outlook a {padding:0;} /* Force Outlook to provide a "view in browser" menu link. */
body{width:100% !important; -webkit-text-size-adjust:100%; -ms-text-size-adjust:100%; margin:0; padding:0;}
/* Prevent Webkit and Windows Mobile platforms from changing default font sizes.*/
.ExternalClass {width:100%;} /* Force Hotmail to display emails at full width */
.ExternalClass, .ExternalClass p, .ExternalClass span, .ExternalClass font, .ExternalClass td, .ExternalClass div {line-height: 100%;}
/* Forces Hotmail to display normal line spacing. More on that: http://www.emailonacid.com/forum/viewthread/43/ */
#backgroundTable {margin:0; padding:0; line-height: 100% !important;}
/* End reset */
/* defaults for images*/
img {outline:none; text-decoration:none; -ms-interpolation-mode: bicubic;}
a img {border:none;}
.image_fix {display:block;}
<div>
--
<br/>
<br/>
<b>${_('This is a notification from RhodeCode. %(instance_url)s') % {'instance_url': instance_url}}</b>
</div>
body {line-height:1.2em;}
p {margin: 0 0 20px;}
h1, h2, h3, h4, h5, h6 {color:#323232!important;}
a {color:#427cc9;text-decoration:none;outline:none;cursor:pointer;}
a:focus {outline:none;}
a:hover {color: #305b91;}
h1 a, h2 a, h3 a, h4 a, h5 a, h6 a {color:#427cc9!important;text-decoration:none!important;}
h1 a:active, h2 a:active, h3 a:active, h4 a:active, h5 a:active, h6 a:active {color: #305b91!important;}
h1 a:visited, h2 a:visited, h3 a:visited, h4 a:visited, h5 a:visited, h6 a:visited {color: #305b91!important;}
table {font-size:13px;border-collapse:collapse;mso-table-lspace:0pt;mso-table-rspace:0pt;}
table td {padding:.65em 1em .65em 0;border-collapse:collapse;vertical-align:top;text-align:left;}
input {display:inline;border-radius:2px;border-style:solid;border: 1px solid #dbd9da;padding:.5em;}
input:focus {outline: 1px solid #979797}
@media only screen and (-webkit-min-device-pixel-ratio: 2) {
/* Put your iPhone 4g styles in here */
}
/* Android targeting */
@media only screen and (-webkit-device-pixel-ratio:.75){
/* Put CSS for low density (ldpi) Android layouts in here */
}
@media only screen and (-webkit-device-pixel-ratio:1){
/* Put CSS for medium density (mdpi) Android layouts in here */
}
@media only screen and (-webkit-device-pixel-ratio:1.5){
/* Put CSS for high density (hdpi) Android layouts in here */
}
/* end Android targeting */
</style>
<!-- Targeting Windows Mobile -->
<!--[if IEMobile 7]>
<style type="text/css">
</style>
<![endif]-->
<!--[if gte mso 9]>
<style>
/* Target Outlook 2007 and 2010 */
</style>
<![endif]-->
</head>
<body>
<!-- Wrapper/Container Table: Use a wrapper table to control the width and the background color consistently of your email. Use this approach instead of setting attributes on the body tag. -->
<table cellpadding="0" cellspacing="0" border="0" id="backgroundTable" align="left" style="margin:1%;width:97%;padding:0;font-family:sans-serif;font-weight:100;border:1px solid #dbd9da">
<tr>
<td valign="top" style="padding:0;">
<table cellpadding="0" cellspacing="0" border="0" align="left" width="100%">
<tr><td style="width:100%;padding:7px;background-color:#202020" valign="top">
<a style="width:100%;height:100%;display:block;color:#eeeeee;text-decoration:none;" href="${instance_url}">
${_('RhodeCode')}
% if c.rhodecode_name:
- ${c.rhodecode_name}
% endif
</a>
</td></tr>
<tr><td style="padding:15px;" valign="top">${self.body()}</td></tr>
</table>
</td>
</tr>
</table>
<!-- End of wrapper table -->
<p><a style="margin-top:15px;margin-left:1%;font-family:sans-serif;font-weight:100;font-size:11px;display:block;color:#666666;text-decoration:none;" href="${instance_url}">
${self.plaintext_footer()}
</a></p>
</body>
</html>

View file

@ -2,7 +2,7 @@
<%inherit file="base.mako"/>
<%def name="subject()" filter="n,trim">
${_('[mention]') if mention else ''} ${_('%(user)s commented on commit of %(repo_name)s') % {
${_('[mention]') if mention else ''} ${_('%(user)s commented on a commit of %(repo_name)s') % {
'user': h.person(user),
'repo_name': repo_name
} }
@ -28,30 +28,21 @@ ${comment_body|n}
${_('Commit status was changed to')}: *${status_change}*
%endif
${self.plaintext_footer()}
</%def>
<table style="text-align:left;vertical-align:middle;">
<tr><td colspan="2" style="width:100%;padding-bottom:15px;border-bottom:1px solid #dbd9da;"><h4><a href="${commit_comment_url}" style="color:#427cc9;text-decoration:none;cursor:pointer">
% if comment_file:
<h4>${_('%(user)s commented on a file in commit of %(repo_url)s.') % {'user': h.person(user), 'repo_url': commit_target_repo} |n}</h4>
${_('%(user)s commented on %(comment_file)s on line %(comment_line)s</a> in the %(repo)s repository') % {'user': h.person(user), 'comment_file': comment_file, 'comment_line': comment_line, 'repo': commit_target_repo} |n}</h4>
% else:
<h4>${_('%(user)s commented on a commit of %(repo_url)s.') % {'user': h.person(user), 'repo_url': commit_target_repo} |n}</h4>
${_('%(user)s commented on a commit</a> in the %(repo)s repository') % {'user': h.person(user), 'repo': commit_target_repo} |n}
% endif
<ul>
<li>${_('Comment link')}: <a href="${commit_comment_url}">${commit_comment_url}</a></li>
%if comment_file:
<li>${_('File: %(comment_file)s on line %(comment_line)s') % {'comment_file': comment_file, 'comment_line': comment_line}}</li>
</h4></td></tr>
<tr><td style="padding-right:20px;padding-top:15px;">${_('Commit')}</td><td style="padding-top:15px;"><a href="${commit_comment_url}" style="color:#427cc9;text-decoration:none;cursor:pointer">${h.show_id(commit)}</a></td></tr>
<tr><td style="padding-right:20px;">${_('Description')}</td><td>${h.urlify_commit_message(commit.message, repo_name)}</td></tr>
%if status_change:
<tr><td style="padding-right:20px;">${_('Status')}<td/>${_('The commit status was changed to')} ${status_change}.</td></tr>
%endif
<li>${_('Commit')}: ${h.show_id(commit)}</li>
<li>
${_('Commit Description')}: <p>${h.urlify_commit_message(commit.message, repo_name)}</p>
</li>
</ul>
<hr>
<p>${h.render(comment_body, renderer=renderer_type, mentions=True)}</p>
<hr/>
%if status_change:
<p>${_('Commit status was changed to')}: <b>${status_change}</b></p>
%endif
<tr><td style="padding-right:20px;">${_('Comment')}</td><td style="line-height:1.2em;">${h.render(comment_body, renderer=renderer_type, mentions=True)}</td></tr>
</table>

View file

@ -11,6 +11,6 @@ ${body}
</%def>
## BODY GOES BELOW
<div style="white-space: pre-wrap">
${body_plaintext()}
</div>
<table style="text-align:left;vertical-align:top;">
<tr><td style="padding-right:20px;padding-top:15px;white-space:pre-wrap">${body}</td></tr>
</table>

View file

@ -16,9 +16,16 @@ There was a request to reset your password using the email address ${email} on $
You can continue, and generate new password by clicking following URL:
${password_reset_url}
${self.plaintext_footer()}
</%def>
## BODY GOES BELOW
<div style="white-space: pre-wrap">
${body_plaintext()}
</div>
<p>
Hello ${user.username},
</p><p>
There was a request to reset your password using the email address ${email} on ${h.format_date(date)}
<br/>
<strong>If you did not request a password reset, please contact your RhodeCode administrator.</strong>
</p><p>
${_('<a href="%(url)s">Generate new password here</a>.') % {'url': password_reset_url} |n}
</p>

View file

@ -9,14 +9,22 @@ Your new RhodeCode password
<%def name="body_plaintext()" filter="n,trim">
Hi ${user.username},
Below is your new access password for RhodeCode.
There was a request to reset your password using the email address ${email} on ${h.format_date(date)}
password: ${new_password}
*If you didn't do this, please contact your RhodeCode administrator.*
*If you didn't request a new password, please contact your RhodeCode administrator immediately.*
You can continue, and generate new password by clicking following URL:
${password_reset_url}
${self.plaintext_footer()}
</%def>
## BODY GOES BELOW
<div style="white-space: pre-wrap">
${body_plaintext()}
</div>
<p>
Hello ${user.username},
</p><p>
Below is your new access password for RhodeCode.
<br/>
<strong>If you didn't request a new password, please contact your RhodeCode administrator.</strong>
</p>
<p>password: <input value='${new_password}'></pre></p>

View file

@ -2,11 +2,11 @@
<%inherit file="base.mako"/>
<%def name="subject()" filter="n,trim">
${_('[mention]') if mention else ''} ${_('%(user)s commented on pull request #%(pr_id)s: "%(pr_title)s"') % {
'user': h.person(user),
'pr_title': pull_request.title,
'pr_id': pull_request.pull_request_id
} |n}
${_('[mention]') if mention else ''} ${_('%(user)s commented on pull request #%(pr_id)s: "%(pr_title)s"') % {
'user': h.person(user),
'pr_title': pull_request.title,
'pr_id': pull_request.pull_request_id
} |n}
</%def>
<%def name="body_plaintext()" filter="n,trim">
@ -31,36 +31,30 @@ ${comment_body|n}
${_('Pull request was closed with status')}: *${status_change}*
%endif
${self.plaintext_footer()}
</%def>
<table style="text-align:left;vertical-align:middle;">
<tr><td colspan="2" style="width:100%;padding-bottom:15px;border-bottom:1px solid #dbd9da;"><h4><a href="${pr_comment_url}" style="color:#427cc9;text-decoration:none;cursor:pointer">
% if comment_file:
<h4>${_('%(user)s commented on a file on pull request #%(pr_id)s: "%(pr_title)s".') % {
'user': h.person(user),
'pr_title': pull_request.title,
'pr_id': pull_request.pull_request_id
} |n}</h4>
% else:
<h4>${_('%(user)s commented on a pull request #%(pr_id)s "%(pr_title)s".') % {
'user': h.person(user),
'pr_title': pull_request.title,
'pr_id': pull_request.pull_request_id
} |n}</h4>
% endif
<ul>
<li>${_('Comment link')}: <a href="${pr_comment_url}">${pr_comment_url}</a></li>
<li>${_('Source repository')}: <a href="${pr_source_repo_url}">${pr_source_repo.repo_name}</a></li>
%if comment_file:
<li>${_('File: %(comment_file)s on line %(comment_line)s') % {'comment_file': comment_file, 'comment_line': comment_line}}</li>
%endif
</ul>
<hr>
<p>${h.render(comment_body, renderer=renderer_type, mentions=True)}</p>
<hr/>
%if status_change and not closing_pr:
<p>${_('Pull request status was changed to')}: <b>${status_change}</b></p>
${_('%(user)s commented on %(comment_file)s on pull request #%(pr_id)s: "%(pr_title)s".') % {'user': h.person(user), 'comment_file': comment_file, 'pr_title': pull_request.title, 'pr_id': pull_request.pull_request_id} |n}
% elif status_change and not closing_pr:
${_('%(user)s changed the status of pull request #%(pr_id)s "%(pr_title)s" to %(status)s.') % {'user': h.person(user),'pr_title': pull_request.title,'pr_id': pull_request.pull_request_id, 'status': status_change} |n}
%elif status_change and closing_pr:
<p>${_('Pull request was closed with status')}: <b>${status_change}</b></p>
%endif
${_('%(user)s closed pull request #%(pr_id)s "%(pr_title)s" with status %(status)s.') % {'user': h.person(user),'pr_title': pull_request.title,'pr_id': pull_request.pull_request_id, 'status': status_change} |n}
%else:
${_('%(user)s commented in pull request #%(pr_id)s "%(pr_title)s".') % {'user': h.person(user),'pr_title': pull_request.title,'pr_id': pull_request.pull_request_id} |n}
% endif
</a></h4></td></tr>
<tr><td style="padding-right:20px;padding-top:15px;">${_('Source')}</td><td style="padding-top:15px;"><a style="color:#427cc9;text-decoration:none;cursor:pointer" href="${pr_source_repo_url}">${pr_source_repo.repo_name}</a></td></tr>
% if comment_file:
<tr><td style="padding-right:20px;">${_('File')}</td><td>${_('%(comment_file)s on line %(comment_line)s') % {'comment_file': comment_file, 'comment_line': comment_line}}</td></tr>
%endif
%if status_change and not closing_pr:
<tr><td style="padding-right:20px;">${_('Status')}</td><td>${_('The commit status was changed to')} ${status_change}</td></tr>
%elif status_change and closing_pr:
<tr><td style="padding-right:20px;">${_('Status')}</td><td>${_('Pull request was closed with status')}: ${status_change}</td></tr>
%endif
<tr><td style="padding-right:20px;">${_('Comment')}</td><td style="line-height:1.2em;">${h.render(comment_body, renderer=renderer_type, mentions=True)}</td></tr>
</table>

View file

@ -29,53 +29,33 @@ ${h.literal(_('Pull request from %(source_ref_type)s:%(source_ref_name)s of %(re
* ${_('Description')}:
${pull_request.description}
${pull_request.description}
* ${ungettext('Commit (%(num)s)', 'Commits (%(num)s)', len(pull_request_commits) ) % {'num': len(pull_request_commits)}}:
% for commit_id, message in pull_request_commits:
- ${h.short_id(commit_id)}
${h.chop_at_smart(message, '\n', suffix_if_chopped='...')}
${h.chop_at_smart(message, '\n', suffix_if_chopped='...')}
% endfor
${self.plaintext_footer()}
</%def>
<h4>
${_('%(user)s wants you to review pull request #%(pr_id)s: "%(pr_title)s".') % {
'user': h.person(user),
'pr_title': pull_request.title,
'pr_id': pull_request.pull_request_id
} }
</h4>
<p>${h.literal(_('Pull request from %(source_ref_type)s:%(source_ref_name)s of %(repo_url)s into %(target_ref_type)s:%(target_ref_name)s') % {
'source_ref_type': pull_request.source_ref_parts.type,
'source_ref_name': pull_request.source_ref_parts.name,
'target_ref_type': pull_request.target_ref_parts.type,
'target_ref_name': pull_request.target_ref_parts.name,
'repo_url': h.link_to(pull_request_source_repo.repo_name, pull_request_source_repo_url)
})}
</p>
<p>${_('Link')}: ${h.link_to(pull_request_url, pull_request_url)}</p>
<p><strong>${_('Title')}</strong>: ${pull_request.title}</p>
<p>
<strong>${_('Description')}:</strong><br/>
<span style="white-space: pre-wrap;">${pull_request.description}</span>
</p>
<p>
<strong>${ungettext('Commit (%(num)s)', 'Commits (%(num)s)', len(pull_request_commits) ) % {'num': len(pull_request_commits)}}</strong>:
<ol>
% for commit_id, message in pull_request_commits:
<li>
<pre>${h.short_id(commit_id)}</pre>
${h.chop_at_smart(message, '\n', suffix_if_chopped='...')}
</li>
% endfor
</ol>
</p>
<table style="text-align:left;vertical-align:middle;">
<tr><td colspan="2" style="width:100%;padding-bottom:15px;border-bottom:1px solid #dbd9da;"><h4><a href="${pull_request_url}" style="color:#427cc9;text-decoration:none;cursor:pointer">${_('%(user)s wants you to review pull request #%(pr_id)s: "%(pr_title)s".') % { 'user': h.person(user), 'pr_title': pull_request.title, 'pr_id': pull_request.pull_request_id } }</a></h4></td></tr>
<tr><td style="padding-right:20px;padding-top:15px;">${_('Title')}</td><td style="padding-top:15px;">${pull_request.title}</td></tr>
<tr><td style="padding-right:20px;">${_('Source')}</td><td>${h.literal(_('<pre style="display:inline;border-radius:2px;color:#666666;font-size:12px;background-color:#f9f9f9;padding:.2em;border:1px solid #979797;">%(source_ref_name)s</pre> %(source_ref_type)s of %(source_repo_url)s') % {'source_ref_type': pull_request.source_ref_parts.type,'source_ref_name': pull_request.source_ref_parts.name,'source_repo_url': h.link_to(pull_request_source_repo.repo_name, pull_request_source_repo_url)})}</td></tr>
<tr><td style="padding-right:20px;">${_('Target')}</td><td>${h.literal(_('<pre style="display:inline;border-radius:2px;color:#666666;font-size:12px;background-color:#f9f9f9;padding:.2em;border:1px solid #979797;">%(target_ref_name)s</pre> %(target_ref_type)s of %(target_repo_url)s') % {'target_ref_type': pull_request.target_ref_parts.type,'target_ref_name': pull_request.target_ref_parts.name,'target_repo_url': h.link_to(pull_request_target_repo.repo_name, pull_request_target_repo_url)})}</td></tr>
<tr><td style="padding-right:20px;">${_('Description')}</td><td style="white-space:pre-wrap">${pull_request.description}</td></tr>
<tr><td style="padding-right:20px;">${ungettext('%(num)s Commit', '%(num)s Commits', len(pull_request_commits)) % {'num': len(pull_request_commits)}}</td>
<td><ol style="margin:0 0 0 1em;padding:0;text-align:left;">
% for commit_id, message in pull_request_commits:
<li style="margin:0 0 1em;"><pre style="margin:0 0 .5em">${h.short_id(commit_id)}</pre>
${h.chop_at_smart(message, '\n', suffix_if_chopped='...')}
</li>
% endfor
</ol></td>
</tr>
</table>

View file

@ -2,10 +2,9 @@
<%inherit file="base.mako"/>
<%def name="subject()" filter="n,trim">
RhodeCode new user registration
RhodeCode new user registration: ${user.username}
</%def>
## plain text version of the email. Empty by default
<%def name="body_plaintext()" filter="n,trim">
A new user `${user.username}` has registered on ${h.format_date(date)}
@ -14,9 +13,15 @@ A new user `${user.username}` has registered on ${h.format_date(date)}
- Full Name: ${user.firstname} ${user.lastname}
- Email: ${user.email}
- Profile link: ${h.url('user_profile', username=user.username, qualified=True)}
${self.plaintext_footer()}
</%def>
## BODY GOES BELOW
<div style="white-space: pre-wrap">
${body_plaintext()}
</div>
<table style="text-align:left;vertical-align:middle;">
<tr><td colspan="2" style="width:100%;padding-bottom:15px;border-bottom:1px solid #dbd9da;"><h4><a href="${h.url('user_profile', username=user.username, qualified=True)}" style="color:#427cc9;text-decoration:none;cursor:pointer">${_('New user %(user)s has registered on %(date)s') % {'user': user.username, 'date': h.format_date(date)}}</h4></td></tr>
<tr><td style="padding-right:20px;padding-top:20px;">${_('Username')}</td><td style="line-height:1;padding-top:20px;"><img style="margin-bottom:-5px;text-align:left;border:1px solid #dbd9da" src="${h.gravatar_url(user.email, 16)}" height="16" width="16">&nbsp;${user.username}</td></tr>
<tr><td style="padding-right:20px;">${_('Full Name')}</td><td>${user.firstname} ${user.lastname}</td></tr>
<tr><td style="padding-right:20px;">${_('Email')}</td><td>${user.email}</td></tr>
<tr><td style="padding-right:20px;">${_('Profile')}</td><td><a href="${h.url('user_profile', username=user.username, qualified=True)}">${h.url('user_profile', username=user.username, qualified=True)}</a></td></tr>
</table>