blob: 870ad464128ba246e329f97a574544a79b196220 [file] [log] [blame]
/**
* Copyright (C) 2016 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
{namespace com.google.gerrit.server.mail.template}
/**
* @param commentFiles
* @param commentCount
* @param email
* @param labels
* @param patchSet
* @param patchSetCommentBlocks
*/
{template .CommentHtml autoescape="strict" kind="html"}
{let $commentHeaderStyle kind="css"}
margin-bottom: 4px;
{/let}
{let $blockquoteStyle kind="css"}
border-left: 1px solid #aaa;
margin: 10px 0;
padding: 0 10px;
{/let}
{let $ulStyle kind="css"}
list-style: none;
padding: 0;
{/let}
{let $fileLiStyle kind="css"}
margin: 0;
padding: 0;
{/let}
{let $commentLiStyle kind="css"}
margin: 0;
padding: 0 0 0 16px;
{/let}
{let $voteStyle kind="css"}
border-radius: 3px;
display: inline-block;
margin: 0 2px;
padding: 4px;
{/let}
{let $positiveVoteStyle kind="css"}
{$voteStyle}
background-color: #d4ffd4;
{/let}
{let $negativeVoteStyle kind="css"}
{$voteStyle}
background-color: #ffd4d4;
{/let}
{let $neutralVoteStyle kind="css"}
{$voteStyle}
background-color: #ddd;
{/let}
{if $patchSetCommentBlocks}
{call .WikiFormat}{param content: $patchSetCommentBlocks /}{/call}
{/if}
{if length($labels) > 0}
<p>
Patch set {$patchSet.patchSetId}:
{foreach $label in $labels}
{if $label.value > 0}
<span style="{$positiveVoteStyle}">
{$label.label}{sp}+{$label.value}
</span>
{elseif $label.value < 0}
<span style="{$negativeVoteStyle}">
{$label.label}{sp}{$label.value}
</span>
{else}
<span style="{$neutralVoteStyle}">
-{$label.label}
</span>
{/if}
{/foreach}
</p>
{/if}
{if $email.changeUrl}
<p>
{call .ViewChangeButton data="all" /}
</p>
{/if}
{if $commentCount == 1}
<p>1 comment:</p>
{elseif $commentCount > 1}
<p>{$commentCount} comments:</p>
{/if}
<ul style="{$ulStyle}">
{foreach $group in $commentFiles}
<li style="{$fileLiStyle}">
<p>
<a href="{$group.link}">{$group.title}:</a>
</p>
<ul style="{$ulStyle}">
{foreach $comment in $group.comments}
<li style="{$commentLiStyle}">
{if $comment.isRobotComment}
<p style="{$commentHeaderStyle}">
Robot Comment from{sp}
{if $comment.robotUrl}<a href="{$comment.robotUrl}">{/if}
{$comment.robotId}
{if $comment.robotUrl}</a>{/if}{sp}
(run ID {$comment.robotRunId}):
</p>
{/if}
<p style="{$commentHeaderStyle}">
<a href="{$comment.link}">
{if $comment.startLine == 0}
Patch Set #{$group.patchSetId}:
{else}
Patch Set #{$group.patchSetId},{sp}
Line {$comment.startLine}:
{/if}
</a>{sp}
{if length($comment.lines) == 1}
<code style="font-family:monospace,monospace">
{$comment.lines[0]}
</code>
{/if}
</p>
{if length($comment.lines) > 1}
<p>
<blockquote style="{$blockquoteStyle}">
{call .Pre}{param content kind="html"}
{foreach $line in $comment.lines}
{$line}{\n}
{/foreach}
{/param}{/call}
</blockquote>
</p>
{/if}
{if $comment.parentMessage}
<p>
<blockquote style="{$blockquoteStyle}">
{$comment.parentMessage}
</blockquote>
</p>
{/if}
{call .WikiFormat}{param content: $comment.messageBlocks /}{/call}
</li>
{/foreach}
</ul>
</li>
{/foreach}
</ul>
{/template}