Changeset - 2b2e37660e95
[Not reviewed]
default
0 5 0
Thomas De Schampheleire - 8 years ago 2018-02-13 11:09:14
thomas.de_schampheleire@nokia.com
HTML email templates: introduce link_style variable

Avoid repetition inside the templates and simplify future refactoring by
using 'style' variables provided by the model.
5 files changed with 11 insertions and 10 deletions:
0 comments (0 inline, 0 general)
kallithea/model/notification.py
Show inline comments
 
@@ -330,16 +330,17 @@ class EmailNotificationModel(object):
 
                "color_emph": "#395fa0",
 
                "color_link": "#395fa0",
 
                "color_border": "#ddd",
 
                "color_background_grey": "#f9f9f9",
 
                "color_button": "#395fa0",
 
                "monospace_style": "font-family:Lucida Console,Consolas,Monaco,Inconsolata,Liberation Mono,monospace",
 
                "sans_style": "font-family:Helvetica,Arial,sans-serif",
 
                })
 
            _kwargs.update({
 
                "default_style": "%(sans_style)s;font-weight:200;font-size:14px;line-height:17px;color:%(color_text)s" % _kwargs,
 
                "comment_style": "%(monospace_style)s;white-space:pre-wrap" % _kwargs,
 
                "emph_style": "font-weight:600;color:%(color_emph)s" % _kwargs,
 
                "link_style": "color:%(color_link)s;text-decoration:none" % _kwargs,
 
                })
 

	
 
        log.debug('rendering tmpl %s with kwargs %s', base, _kwargs)
 
        return email_template.render_unicode(**_kwargs)
kallithea/templates/email_templates/changeset_comment.html
Show inline comments
 
@@ -9,31 +9,31 @@
 
    <tr>
 
        <td>
 
<%include file="comment.html" args="text=body,author=cs_comment_user,status=status_change"/>\
 
        </td>
 
    </tr>
 
    <tr>
 
        <td height="30px" style="height:30px"></td>
 
    </tr>
 
    <tr>
 
        <td>
 
            <div>
 
                ${_('Changeset on')}
 
                <a style="color:${color_link};text-decoration:none"
 
                <a style="${link_style}"
 
                   href="${cs_target_repo}">${cs_target_repo}</a>
 
                ${_('branch')}
 
                <span style="color:${color_link}">${branch}</span>:
 
            </div>
 
            <div>
 
                "<a style="color:${color_link};text-decoration:none"
 
                "<a style="${link_style}"
 
                   href="${cs_url}">${h.shorter(message, 60, firstline=True)}</a>"
 
                ${_('by')}
 
                <span style="color:${color_link}">${cs_author.full_name_and_username}</span>.
 
            </div>
 
        </td>
 
    </tr>
 
    <tr>
 
        <td>
 
<%include file="button.html" args="url=cs_comment_url,title=_('View Comment'),padding_bottom=False"/>\
 
        </td>
 
    </tr>
 
</table>
kallithea/templates/email_templates/password_reset.html
Show inline comments
 
@@ -18,25 +18,25 @@
 
    </tr>
 
    <tr>
 
        <td height="10px" style="height:10px"></td>
 
    </tr>
 
    <tr>
 
        <td>
 
            %if reset_token is None:
 
                <div>${_('This account is however managed outside this system and the password cannot be changed here.')}</div>
 
            %else:
 
                <div>
 
                    ${_('To set a new password, click the following link')}:
 
                    <br/>
 
                    <a style="color:${color_link};text-decoration:none" href="${reset_url}"
 
                    <a style="${link_style}" href="${reset_url}"
 
                        target="_blank">${reset_url}</a>
 
                    <br/>
 
                    ${_("Should you not be able to use the link above, please type the following code into the password reset form")}:
 
                    <code>${reset_token}</code>
 
                </div>
 
            %endif
 
        </td>
 
    </tr>
 
    <tr>
 
        <td height="10px" style="height:10px"></td>
 
    </tr>
 
    <tr>
kallithea/templates/email_templates/pull_request.html
Show inline comments
 
<%inherit file="main.html"/>\
 
\
 
<%block name="header">\
 
<% title = _('Mention on Pull Request %s "%s" by %s') % (pr_nice_id, pr_title, pr_user_created) if is_mention else _('Added as Reviewer of Pull Request %s "%s" by %s') % (pr_nice_id, pr_title, pr_user_created) %>\
 
<%include file="header.html" args="title=title,link=pr_url"/>\
 
</%block>\
 
\
 
<table cellpadding="0" cellspacing="0" border="0" width="100%">
 
    <tr>
 
        <td>
 
            <div>
 
                ${_('Pull request from')}
 
                <a style="color:${color_link};text-decoration:none"
 
                <a style="${link_style}"
 
                   href="${pr_source_repo}">${pr_source_repo}</a>
 
                ${_('at')}
 
                <span style="color:${color_link}">${pr_source_branch}</span>
 
                ${_('to')}
 
                <a style="color:${color_link};text-decoration:none"
 
                <a style="${link_style}"
 
                   href="${pr_target_repo}">${pr_target_repo}</a>
 
                ${_('at')}
 
                <span style="color:${color_link}">${pr_target_branch}</span>:
 
            </div>
 
            <div>
 
                <a style="color:${color_link};text-decoration:none"
 
                <a style="${link_style}"
 
                   href="${pr_url}">${pr_nice_id}</a>
 
                "<span style="color:${color_link}">${pr_title}</span>"
 
                ${_('by')}
 
                <span style="color:${color_link}">${pr_owner.full_name_and_username}</span>.
 
            </div>
 
        </td>
 
    </tr>
 
    <tr><td height="10px" style="height:10px"></td></tr>
 
    <tr>
 
        <td>
 
            <div>
 
                ${_('Description')}:
 
@@ -47,25 +47,25 @@
 
    <tr>
 
        <td>
 
            <div>${_('Changesets')}:</div>
 
        </td>
 
    </tr>
 
    <tr><td height="10px" style="height:10px"></td></tr>
 

	
 
    <tr>
 
        <td style="${sans_style}">
 
            <ul style="color:${color_link};padding-left:15px;margin:0">
 
                %for revision, desc in pr_revisions:
 
                    <li style="mso-special-format:bullet">
 
                        <a style="color:${color_link};text-decoration:none"
 
                        <a style="${link_style}"
 
                           href="${h.canonical_url('changeset_home', repo_name=org_repo_name, revision=revision)}">
 
                            ${h.shorter(desc, 80, firstline=True)}
 
                        </a>
 
                    </li>
 
                %endfor
 
            </ul>
 
        </td>
 
    </tr>
 
    <tr>
 
        <td>
 
<%include file="button.html" args="url=pr_url,title=_('View Pull Request'),padding_bottom=False"/>\
 
        </td>
kallithea/templates/email_templates/pull_request_comment.html
Show inline comments
 
@@ -9,36 +9,36 @@
 
    <tr>
 
        <td>
 
<%include file="comment.html" args="text=body,author=pr_comment_user,status=status_change,close=closing_pr"/>\
 
        </td>
 
    </tr>
 
    <tr>
 
        <td height="30px" style="height:30px"></td>
 
    </tr>
 
    <tr>
 
        <td>
 
            <div>
 
                ${_('Pull request from')}
 
                <a style="color:${color_link};text-decoration:none"
 
                <a style="${link_style}"
 
                   href="${pr_source_repo}">${pr_source_repo}</a>
 
                ${_('branch')}
 
                <span style="color:${color_link}">${pr_source_branch}</span>
 
                ${_('to')}
 
                <a style="color:${color_link};text-decoration:none"
 
                <a style="${link_style}"
 
                   href="${pr_target_repo}">${pr_target_repo}</a>
 
                ${_('branch')}
 
                <span style="color:${color_link}">${pr_target_branch}</span>:
 
            </div>
 
            <div>
 
                <a style="color:${color_link};text-decoration:none"
 
                <a style="${link_style}"
 
                   href="${pr_url}">${pr_nice_id}</a>
 
                "<span style="color:${color_link}">${pr_title}</span>"
 
                ${_('by')}
 
                <span style="color:${color_link}">${pr_owner.full_name_and_username}</span>.
 
            </div>
 
        </td>
 
    </tr>
 
    <tr>
 
        <td>
 
<%include file="button.html" args="url=pr_comment_url,title=_('View Comment'),padding_bottom=False"/>\
 
        </td>
 
    </tr>
0 comments (0 inline, 0 general)