pull_request_comment.mako
114 lines
| 3.8 KiB
| application/x-mako
|
MakoHtmlLexer
r1 | ## -*- coding: utf-8 -*- | |||
<%inherit file="base.mako"/> | ||||
r548 | <%namespace name="base" file="base.mako"/> | |||
r1 | ||||
r1453 | ## EMAIL SUBJECT | |||
r1 | <%def name="subject()" filter="n,trim"> | |||
r532 | <% | |||
data = { | ||||
'user': h.person(user), | ||||
'pr_title': pull_request.title, | ||||
'pr_id': pull_request.pull_request_id, | ||||
'status': status_change, | ||||
'comment_file': comment_file, | ||||
'comment_line': comment_line, | ||||
r1453 | 'comment_type': comment_type, | |||
r532 | } | |||
%> | ||||
${_('[mention]') if mention else ''} \ | ||||
% if comment_file: | ||||
r1453 | ${_('%(user)s left %(comment_type)s on pull request #%(pr_id)s "%(pr_title)s" (file: `%(comment_file)s`)') % data |n} | |||
r532 | % else: | |||
% if status_change: | ||||
r1453 | ${_('%(user)s left %(comment_type)s on pull request #%(pr_id)s "%(pr_title)s" (status: %(status)s)') % data |n} | |||
r532 | % else: | |||
r1453 | ${_('%(user)s left %(comment_type)s on pull request #%(pr_id)s "%(pr_title)s"') % data |n} | |||
r532 | % endif | |||
% endif | ||||
r1 | </%def> | |||
r1453 | ## PLAINTEXT VERSION OF BODY | |||
r1 | <%def name="body_plaintext()" filter="n,trim"> | |||
r532 | <% | |||
data = { | ||||
'user': h.person(user), | ||||
'pr_title': pull_request.title, | ||||
'pr_id': pull_request.pull_request_id, | ||||
'status': status_change, | ||||
'comment_file': comment_file, | ||||
'comment_line': comment_line, | ||||
r1453 | 'comment_type': comment_type, | |||
r532 | } | |||
%> | ||||
r1 | ${self.subject()} | |||
* ${_('Comment link')}: ${pr_comment_url} | ||||
* ${_('Source repository')}: ${pr_source_repo_url} | ||||
%if comment_file: | ||||
* ${_('File: %(comment_file)s on line %(comment_line)s') % {'comment_file': comment_file, 'comment_line': comment_line}} | ||||
%endif | ||||
--- | ||||
r532 | %if status_change and not closing_pr: | |||
${_('%(user)s submitted pull request #%(pr_id)s status: *%(status)s*') % data} | ||||
%elif status_change and closing_pr: | ||||
${_('%(user)s submitted pull request #%(pr_id)s status: *%(status)s and closed*') % data} | ||||
%endif | ||||
r1 | ${comment_body|n} | |||
r508 | ${self.plaintext_footer()} | |||
r1 | </%def> | |||
r532 | ||||
<% | ||||
data = { | ||||
'user': h.person(user), | ||||
'pr_title': pull_request.title, | ||||
'pr_id': pull_request.pull_request_id, | ||||
'status': status_change, | ||||
'comment_file': comment_file, | ||||
'comment_line': comment_line, | ||||
r1453 | 'comment_type': comment_type, | |||
r532 | } | |||
%> | ||||
r508 | <table style="text-align:left;vertical-align:middle;"> | |||
r532 | <tr><td colspan="2" style="width:100%;padding-bottom:15px;border-bottom:1px solid #dbd9da;"> | |||
% if comment_file: | ||||
r1453 | <h4><a href="${pr_comment_url}" style="color:#427cc9;text-decoration:none;cursor:pointer">${_('%(user)s commented on pull request #%(pr_id)s "%(pr_title)s" (file:`%(comment_file)s`)') % data |n}</a></h4> | |||
r532 | % else: | |||
r1453 | <h4><a href="${pr_comment_url}" style="color:#427cc9;text-decoration:none;cursor:pointer">${_('%(user)s commented on pull request #%(pr_id)s "%(pr_title)s"') % data |n}</a></h4> | |||
r532 | % endif | |||
r1453 | ||||
r532 | </td></tr> | |||
r508 | <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> | |||
r1453 | ||||
r548 | % if status_change: | |||
r1453 | <tr> | |||
<td style="padding-right:20px;">${_('Status')}</td> | ||||
<td> | ||||
% if closing_pr: | ||||
${_('Closed pull request with status')}: ${base.status_text(status_change, tag_type=status_change_type)} | ||||
% else: | ||||
${_('Submitted review status')}: ${base.status_text(status_change, tag_type=status_change_type)} | ||||
% endif | ||||
</td> | ||||
</tr> | ||||
r548 | % endif | |||
r1453 | <tr> | |||
<td style="padding-right:20px;"> | ||||
% if comment_type == 'todo': | ||||
${(_('TODO comment on line: %(comment_line)s') if comment_file else _('TODO comment')) % data} | ||||
% else: | ||||
${(_('Note comment on line: %(comment_line)s') if comment_file else _('Note comment')) % data} | ||||
% endif | ||||
</td> | ||||
<td style="line-height:1.2em;white-space:pre-wrap">${h.render(comment_body, renderer=renderer_type, mentions=True)}</td> | ||||
</tr> | ||||
r508 | </table> | |||