# HG changeset patch # User lisaq # Date 2016-07-28 12:12:37 # Node ID dcd63aa255be70974bfae3aedb5896b162e13bd9 # Parent 7d9d213fad369a30bfdc367dc5f5829cd7cd54b0 notifications: restyling email templates #4087 diff --git a/rhodecode/templates/email_templates/base.mako b/rhodecode/templates/email_templates/base.mako --- a/rhodecode/templates/email_templates/base.mako +++ b/rhodecode/templates/email_templates/base.mako @@ -3,15 +3,100 @@ ## headers we additionally can set for email <%def name="headers()" filter="n,trim"> -## 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 name="body_plaintext()" filter="n,trim"> -${self.body()} + + + + + + ${self.subject()} + + + + + + + + + + + + + +
+ + + +
+ + ${_('RhodeCode')} + % if c.rhodecode_name: + - ${c.rhodecode_name} + % endif + +
${self.body()}
+
+ +

+ ${self.plaintext_footer()} +

+ + diff --git a/rhodecode/templates/email_templates/commit_comment.mako b/rhodecode/templates/email_templates/commit_comment.mako --- a/rhodecode/templates/email_templates/commit_comment.mako +++ b/rhodecode/templates/email_templates/commit_comment.mako @@ -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 @@ ${_('Commit status was changed to')}: *${status_change}* %endif +${self.plaintext_footer()} - + + + + + %if status_change: + %endif -
  • ${_('Commit')}: ${h.show_id(commit)}
  • -
  • - ${_('Commit Description')}:

    ${h.urlify_commit_message(commit.message, repo_name)}

    -
  • - - -
    -

    ${h.render(comment_body, renderer=renderer_type, mentions=True)}

    -
    - -%if status_change: -

    ${_('Commit status was changed to')}: ${status_change}

    -%endif + +

    % if comment_file: -

    ${_('%(user)s commented on a file in commit of %(repo_url)s.') % {'user': h.person(user), 'repo_url': commit_target_repo} |n}

    + ${_('%(user)s commented on %(comment_file)s on line %(comment_line)s
    in the %(repo)s repository') % {'user': h.person(user), 'comment_file': comment_file, 'comment_line': comment_line, 'repo': commit_target_repo} |n}

    % else: -

    ${_('%(user)s commented on a commit of %(repo_url)s.') % {'user': h.person(user), 'repo_url': commit_target_repo} |n}

    + ${_('%(user)s commented on a commit in the %(repo)s repository') % {'user': h.person(user), 'repo': commit_target_repo} |n} % endif - -
      -
    • ${_('Comment link')}: ${commit_comment_url}
    • - %if comment_file: -
    • ${_('File: %(comment_file)s on line %(comment_line)s') % {'comment_file': comment_file, 'comment_line': comment_line}}
    • +
    ${_('Commit')}${h.show_id(commit)}
    ${_('Description')}${h.urlify_commit_message(commit.message, repo_name)}
    ${_('Status')}${_('The commit status was changed to')} ${status_change}.
    ${_('Comment')}${h.render(comment_body, renderer=renderer_type, mentions=True)}
    \ No newline at end of file diff --git a/rhodecode/templates/email_templates/main.mako b/rhodecode/templates/email_templates/main.mako --- a/rhodecode/templates/email_templates/main.mako +++ b/rhodecode/templates/email_templates/main.mako @@ -11,6 +11,6 @@ ## BODY GOES BELOW -
    -${body_plaintext()} -
    \ No newline at end of file + + +
    ${body}
    \ No newline at end of file diff --git a/rhodecode/templates/email_templates/password_reset.mako b/rhodecode/templates/email_templates/password_reset.mako --- a/rhodecode/templates/email_templates/password_reset.mako +++ b/rhodecode/templates/email_templates/password_reset.mako @@ -16,9 +16,16 @@ There was a request to reset your passwo You can continue, and generate new password by clicking following URL: ${password_reset_url} +${self.plaintext_footer()} ## BODY GOES BELOW -
    -${body_plaintext()} -
    \ No newline at end of file +

    +Hello ${user.username}, +

    +There was a request to reset your password using the email address ${email} on ${h.format_date(date)} +
    +If you did not request a password reset, please contact your RhodeCode administrator. +

    +${_('Generate new password here.') % {'url': password_reset_url} |n} +

    \ No newline at end of file diff --git a/rhodecode/templates/email_templates/password_reset_confirmation.mako b/rhodecode/templates/email_templates/password_reset_confirmation.mako --- a/rhodecode/templates/email_templates/password_reset_confirmation.mako +++ b/rhodecode/templates/email_templates/password_reset_confirmation.mako @@ -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)} + +*If you didn't do this, please contact your RhodeCode administrator.* -password: ${new_password} +You can continue, and generate new password by clicking following URL: +${password_reset_url} -*If you didn't request a new password, please contact your RhodeCode administrator immediately.* +${self.plaintext_footer()} ## BODY GOES BELOW -
    -${body_plaintext()} -
    \ No newline at end of file +

    +Hello ${user.username}, +

    +Below is your new access password for RhodeCode. +
    +If you didn't request a new password, please contact your RhodeCode administrator. +

    +

    password:

    \ No newline at end of file diff --git a/rhodecode/templates/email_templates/pull_request_comment.mako b/rhodecode/templates/email_templates/pull_request_comment.mako --- a/rhodecode/templates/email_templates/pull_request_comment.mako +++ b/rhodecode/templates/email_templates/pull_request_comment.mako @@ -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 name="body_plaintext()" filter="n,trim"> @@ -31,36 +31,30 @@ ${_('Pull request was closed with status')}: *${status_change}* %endif +${self.plaintext_footer()} + + + + % if comment_file: + + %endif + %if status_change and not closing_pr: + + %elif status_change and closing_pr: + + %endif + +

    % if comment_file: -

    ${_('%(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}

    -% else: -

    ${_('%(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}

    + ${_('%(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: + ${_('%(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 +

    ${_('Source')}${pr_source_repo.repo_name}
    ${_('File')}${_('%(comment_file)s on line %(comment_line)s') % {'comment_file': comment_file, 'comment_line': comment_line}}
    ${_('Status')}${_('The commit status was changed to')} ${status_change}
    ${_('Status')}${_('Pull request was closed with status')}: ${status_change}
    ${_('Comment')}${h.render(comment_body, renderer=renderer_type, mentions=True)}
    - - -
    -

    ${h.render(comment_body, renderer=renderer_type, mentions=True)}

    -
    - -%if status_change and not closing_pr: -

    ${_('Pull request status was changed to')}: ${status_change}

    -%elif status_change and closing_pr: -

    ${_('Pull request was closed with status')}: ${status_change}

    -%endif diff --git a/rhodecode/templates/email_templates/pull_request_review.mako b/rhodecode/templates/email_templates/pull_request_review.mako --- a/rhodecode/templates/email_templates/pull_request_review.mako +++ b/rhodecode/templates/email_templates/pull_request_review.mako @@ -29,53 +29,33 @@ * ${_('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()} - -

    -${_('%(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 - } } -

    - -

    ${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) - })} -

    - -

    ${_('Link')}: ${h.link_to(pull_request_url, pull_request_url)}

    - -

    ${_('Title')}: ${pull_request.title}

    -

    - ${_('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: -
    1. -
      ${h.short_id(commit_id)}
      - ${h.chop_at_smart(message, '\n', suffix_if_chopped='...')} -
    2. - % endfor -
    -

    + + + + + + + + + +

    ${_('%(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 } }

    ${_('Title')}${pull_request.title}
    ${_('Source')}${h.literal(_('
    %(source_ref_name)s
    %(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)})}
    ${_('Target')}${h.literal(_('
    %(target_ref_name)s
    %(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)})}
    ${_('Description')}${pull_request.description}
    ${ungettext('%(num)s Commit', '%(num)s Commits', len(pull_request_commits)) % {'num': len(pull_request_commits)}}
      +% for commit_id, message in pull_request_commits: +
    1. ${h.short_id(commit_id)}
      + ${h.chop_at_smart(message, '\n', suffix_if_chopped='...')} +
    2. +% endfor +
    diff --git a/rhodecode/templates/email_templates/user_registration.mako b/rhodecode/templates/email_templates/user_registration.mako --- a/rhodecode/templates/email_templates/user_registration.mako +++ b/rhodecode/templates/email_templates/user_registration.mako @@ -2,10 +2,9 @@ <%inherit file="base.mako"/> <%def name="subject()" filter="n,trim"> -RhodeCode new user registration +RhodeCode new user registration: ${user.username} -## 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 regist - Full Name: ${user.firstname} ${user.lastname} - Email: ${user.email} - Profile link: ${h.url('user_profile', username=user.username, qualified=True)} + +${self.plaintext_footer()} ## BODY GOES BELOW -
    -${body_plaintext()} -
    + + + + + + +

    ${_('New user %(user)s has registered on %(date)s') % {'user': user.username, 'date': h.format_date(date)}}

    ${_('Username')} ${user.username}
    ${_('Full Name')}${user.firstname} ${user.lastname}
    ${_('Email')}${user.email}
    ${_('Profile')}${h.url('user_profile', username=user.username, qualified=True)}
    \ No newline at end of file