changeset 7160:2b2e37660e95

HTML email templates: introduce link_style variable Avoid repetition inside the templates and simplify future refactoring by using 'style' variables provided by the model.
author Thomas De Schampheleire <thomas.de_schampheleire@nokia.com>
date Tue, 13 Feb 2018 11:09:14 +0100
parents 9cef5615da7b
children d9fc7312177e
files kallithea/model/notification.py kallithea/templates/email_templates/changeset_comment.html kallithea/templates/email_templates/password_reset.html kallithea/templates/email_templates/pull_request.html kallithea/templates/email_templates/pull_request_comment.html
diffstat 5 files changed, 11 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- a/kallithea/model/notification.py	Fri Feb 09 20:19:32 2018 +0100
+++ b/kallithea/model/notification.py	Tue Feb 13 11:09:14 2018 +0100
@@ -339,6 +339,7 @@
                 "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)
--- a/kallithea/templates/email_templates/changeset_comment.html	Fri Feb 09 20:19:32 2018 +0100
+++ b/kallithea/templates/email_templates/changeset_comment.html	Tue Feb 13 11:09:14 2018 +0100
@@ -18,13 +18,13 @@
         <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>.
--- a/kallithea/templates/email_templates/password_reset.html	Fri Feb 09 20:19:32 2018 +0100
+++ b/kallithea/templates/email_templates/password_reset.html	Tue Feb 13 11:09:14 2018 +0100
@@ -27,7 +27,7 @@
                 <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")}:
--- a/kallithea/templates/email_templates/pull_request.html	Fri Feb 09 20:19:32 2018 +0100
+++ b/kallithea/templates/email_templates/pull_request.html	Tue Feb 13 11:09:14 2018 +0100
@@ -10,18 +10,18 @@
         <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')}
@@ -56,7 +56,7 @@
             <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>
--- a/kallithea/templates/email_templates/pull_request_comment.html	Fri Feb 09 20:19:32 2018 +0100
+++ b/kallithea/templates/email_templates/pull_request_comment.html	Tue Feb 13 11:09:14 2018 +0100
@@ -18,18 +18,18 @@
         <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')}