pull_request_comment.mako
201 lines
| 6.6 KiB
| application/x-mako
|
MakoHtmlLexer
r1 | ## -*- coding: utf-8 -*- | |||
<%inherit file="base.mako"/> | ||||
r548 | <%namespace name="base" file="base.mako"/> | |||
r1 | ||||
r1453 | ## EMAIL SUBJECT | |||
r1728 | <%def name="subject()" filter="n,trim,whitespace_filter"> | |||
r532 | <% | |||
data = { | ||||
r4038 | 'user': '@'+h.person(user), | |||
'repo_name': repo_name, | ||||
r532 | 'status': status_change, | |||
'comment_file': comment_file, | ||||
'comment_line': comment_line, | ||||
r1453 | 'comment_type': comment_type, | |||
r4050 | 'comment_id': comment_id, | |||
r4038 | ||||
'pr_title': pull_request.title, | ||||
'pr_id': pull_request.pull_request_id, | ||||
r532 | } | |||
%> | ||||
% if comment_file: | ||||
r4038 | ${(_('[mention]') if mention else '')} ${_('{user} left a {comment_type} on file `{comment_file}` in pull request !{pr_id}: "{pr_title}"').format(**data) |n} | |||
r532 | % else: | |||
% if status_change: | ||||
r4038 | ${(_('[mention]') if mention else '')} ${_('[status: {status}] {user} left a {comment_type} on pull request !{pr_id}: "{pr_title}"').format(**data) |n} | |||
r532 | % else: | |||
r4038 | ${(_('[mention]') if mention else '')} ${_('{user} left a {comment_type} on pull request !{pr_id}: "{pr_title}"').format(**data) |n} | |||
r532 | % endif | |||
% endif | ||||
r4038 | ||||
r1 | </%def> | |||
r1453 | ## PLAINTEXT VERSION OF BODY | |||
r1 | <%def name="body_plaintext()" filter="n,trim"> | |||
r532 | <% | |||
data = { | ||||
'user': h.person(user), | ||||
r4038 | 'repo_name': repo_name, | |||
r532 | 'status': status_change, | |||
'comment_file': comment_file, | ||||
'comment_line': comment_line, | ||||
r1453 | 'comment_type': comment_type, | |||
r4050 | 'comment_id': comment_id, | |||
r4038 | ||||
'pr_title': pull_request.title, | ||||
'pr_id': pull_request.pull_request_id, | ||||
'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, | ||||
'source_repo': pull_request_source_repo.repo_name, | ||||
'target_repo': pull_request_target_repo.repo_name, | ||||
'source_repo_url': pull_request_source_repo_url, | ||||
'target_repo_url': pull_request_target_repo_url, | ||||
r532 | } | |||
%> | ||||
r4038 | ||||
r4060 | * ${_('Comment link')}: ${pr_comment_url} | |||
* ${_('Pull Request')}: !${pull_request.pull_request_id} | ||||
r4038 | ||||
* ${h.literal(_('Commit flow: {source_ref_type}:{source_ref_name} of {source_repo_url} into {target_ref_type}:{target_ref_name} of {target_repo_url}').format(**data))} | ||||
r1 | ||||
r4038 | %if status_change and not closing_pr: | |||
* ${_('{user} submitted pull request !{pr_id} status: *{status}*').format(**data)} | ||||
r1 | ||||
r4038 | %elif status_change and closing_pr: | |||
* ${_('{user} submitted pull request !{pr_id} status: *{status} and closed*').format(**data)} | ||||
%endif | ||||
r1 | %if comment_file: | |||
r4038 | * ${_('File: {comment_file} on line {comment_line}').format(**data)} | |||
r1 | %endif | |||
r4038 | % if comment_type == 'todo': | |||
r4060 | ${('Inline' if comment_file else 'General')} ${_('`TODO` number')} ${comment_id}: | |||
r4038 | % else: | |||
r4060 | ${('Inline' if comment_file else 'General')} ${_('`Note` number')} ${comment_id}: | |||
r4038 | % endif | |||
${comment_body |n, trim} | ||||
r1 | ||||
--- | ||||
r508 | ${self.plaintext_footer()} | |||
r1 | </%def> | |||
r532 | ||||
<% | ||||
data = { | ||||
'user': h.person(user), | ||||
'comment_file': comment_file, | ||||
'comment_line': comment_line, | ||||
r1453 | 'comment_type': comment_type, | |||
r4050 | 'comment_id': comment_id, | |||
r4038 | 'renderer_type': renderer_type or 'plain', | |||
'pr_title': pull_request.title, | ||||
'pr_id': pull_request.pull_request_id, | ||||
'status': status_change, | ||||
'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, | ||||
'source_repo': pull_request_source_repo.repo_name, | ||||
'target_repo': pull_request_target_repo.repo_name, | ||||
'source_repo_url': h.link_to(pull_request_source_repo.repo_name, pull_request_source_repo_url), | ||||
'target_repo_url': h.link_to(pull_request_target_repo.repo_name, pull_request_target_repo_url), | ||||
r532 | } | |||
%> | ||||
r4038 | ||||
<table style="text-align:left;vertical-align:middle;width: 100%"> | ||||
<tr> | ||||
<td style="width:100%;border-bottom:1px solid #dbd9da;"> | ||||
r532 | ||||
r4038 | <h4 style="margin: 0"> | |||
<div style="margin-bottom: 4px; color:#7E7F7F"> | ||||
@${h.person(user.username)} | ||||
</div> | ||||
${_('left a')} | ||||
<a href="${pr_comment_url}" style="${base.link_css()}"> | ||||
% if comment_file: | ||||
${_('{comment_type} on file `{comment_file}` in pull request.').format(**data)} | ||||
% else: | ||||
${_('{comment_type} on pull request.').format(**data) |n} | ||||
% endif | ||||
</a> | ||||
<div style="margin-top: 10px"></div> | ||||
${_('Pull request')} <code>!${data['pr_id']}: ${data['pr_title']}</code> | ||||
</h4> | ||||
r1453 | ||||
r4038 | </td> | |||
</tr> | ||||
</table> | ||||
<table style="text-align:left;vertical-align:middle;width: 100%"> | ||||
## spacing def | ||||
<tr> | ||||
<td style="width: 130px"></td> | ||||
<td></td> | ||||
</tr> | ||||
r1453 | ||||
r548 | % if status_change: | |||
r4038 | <tr> | |||
<td style="padding-right:20px;">${_('Review 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> | ||||
% endif | ||||
r4060 | <tr> | |||
<td style="padding-right:20px;">${_('Pull request')}:</td> | ||||
<td> | ||||
<a href="${pull_request_url}" style="${base.link_css()}"> | ||||
!${pull_request.pull_request_id} | ||||
</a> | ||||
</td> | ||||
</tr> | ||||
r4038 | ||||
<tr> | ||||
<td style="padding-right:20px;line-height:20px;">${_('Commit Flow')}:</td> | ||||
<td style="line-height:20px;"> | ||||
${base.tag_button('{}:{}'.format(data['source_ref_type'], pull_request.source_ref_parts.name))} ${_('of')} ${data['source_repo_url']} | ||||
→ | ||||
${base.tag_button('{}:{}'.format(data['target_ref_type'], pull_request.target_ref_parts.name))} ${_('of')} ${data['target_repo_url']} | ||||
</td> | ||||
</tr> | ||||
r4060 | ||||
r4038 | % if comment_file: | |||
r1453 | <tr> | |||
r4038 | <td style="padding-right:20px;">${_('File')}:</td> | |||
<td><a href="${pr_comment_url}" style="${base.link_css()}">${_('`{comment_file}` on line {comment_line}').format(**data)}</a></td> | ||||
r1453 | </tr> | |||
r548 | % endif | |||
r4038 | ||||
r4050 | <tr style="border-bottom:1px solid #dbd9da;"> | |||
r4038 | <td colspan="2" style="padding-right:20px;"> | |||
r1453 | % if comment_type == 'todo': | |||
r4052 | ${('Inline' if comment_file else 'General')} ${_('`TODO` number')} ${comment_id}: | |||
r1453 | % else: | |||
r4052 | ${('Inline' if comment_file else 'General')} ${_('`Note` number')} ${comment_id}: | |||
r1453 | % endif | |||
</td> | ||||
r4038 | </tr> | |||
r4050 | <tr> | |||
<td colspan="2" style="background: #F7F7F7">${h.render(comment_body, renderer=data['renderer_type'], mentions=True)}</td> | ||||
</tr> | ||||
<tr> | ||||
<td><a href="${pr_comment_reply_url}">${_('Reply')}</a></td> | ||||
<td></td> | ||||
r1453 | </tr> | |||
r508 | </table> | |||