{% extends "notifications/email_base.html" %}
{% load djblets_email djblets_extensions djblets_utils %}
{% load markdown_email rb_extensions %}

{% block content %}
{% if review.ship_it %}
<p>
{%  if has_issues %}
{{review.FIX_IT_THEN_SHIP_IT_TEXT}}
{%  else %}
{{review.SHIP_IT_TEXT}}
{%  endif %}
</p>
{% endif %}

{% template_hook_point "review-email-html-summary" %}
{% if review.body_top %}
 <pre style="{{precss}}">{{review.body_top|markdown_email_html:review.body_top_rich_text}}</pre>
 <br />
{% endif %}

{% for comment in review.screenshot_comments.all %}
<table bgcolor="#f0f0f0" cellpadding="5" cellspacing="5" style="border: 1px solid #c0c0c0; margin-bottom: 10px">
 <tr>
  <td><a href="{{site_url}}{{comment.screenshot.get_absolute_url}}" style="color: black; font-weight: bold; font-size: 9pt;">{{comment.screenshot.image.name|basename}}</a></td>
 </tr>
 <tr>
  <td><a href="{{site_url}}{{comment.screenshot.get_absolute_url}}"><img src="{{site_url}}{{comment.get_image_url}}" style="border: 1px black solid;" alt="{{comment.screenshot.caption}}"></a></td>
 </tr>
</table>
<div style="margin-left: 2em;">
{%  comment_detail_display_hook comment "html-email" %}
 <pre style="{{precss}}">{{comment.text|markdown_email_html:comment.rich_text}}</pre>
</div>
<br />
{% endfor %}

{% for comment in review.file_attachment_comments.all %}
<table bgcolor="#f0f0f0" cellpadding="5" cellspacing="5" style="border: 1px solid #c0c0c0; margin-bottom: 10px">
 <tr>
  <td>
   <a href="{{site_url}}{{comment.get_absolute_url}}" style="color: black; font-weight: bold; font-size: 9pt;">{{comment.get_link_text}}</a>
{% if comment.file_attachment.caption %}
   <p>{{comment.file_attachment.caption}}</p>
{% endif %}
{% with comment.thumbnail as thumbnail %}
{%  if thumbnail %}
    <div>{{thumbnail|default:''|safe}}</div>
{%  endif %}
{% endwith %}
  </td>
 </tr>
</table>
<div style="margin-left: 2em;">
{%  comment_detail_display_hook comment "html-email" %}
 <pre style="{{precss}}">{{comment.text|markdown_email_html:comment.rich_text}}</pre>
</div>
<br />
{% endfor %}

{% for comment in review.general_comments.all %}
<div style="margin-left: 2em;">
{%  comment_detail_display_hook comment "html-email" %}
 <pre style="{{precss}}">{{comment.text|markdown_email_html:comment.rich_text}}</pre>
</div>
<br />
{% endfor %}

{% for entry in comment_entries %}
<div>
{{entry.html|safe}}
 <div style="margin-left: 2em;">
{%  comment_detail_display_hook entry.comment "html-email" %}
  <pre style="{{precss}}">{{entry.comment.text|markdown_email_html:entry.comment.rich_text}}</pre>
 </div>
</div>
<br />
{% endfor %}

{% if review.body_bottom %}
 <pre style="{{precss}}">{{review.body_bottom|markdown_email_html:review.body_bottom_rich_text}}</pre>
{% endif %}
<p>- {{review.user|user_displayname}}</p>
{% endblock %}

{% block footer %}
<br />
<p>On {{review_request.time_emailed|date:"F jS, Y, P T"}}, {{review_request.submitter|user_displayname}} wrote:</p>

{%  with 1 as embedded %}
{%   include "notifications/review_request_email.html" %}
{%  endwith %}
{% endblock %}
