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

{% block content %}

{% if reply.body_top %}
{%  if review.body_top %}
<blockquote style="margin-left: 1em; border-left: 2px solid #d0d0d0; padding-left: 10px;">
 <p style="margin-top: 0;">On {{review.time_emailed|date:"F jS, Y, P T"}}, <b>{{review.user|user_displayname}}</b> wrote:</p>
 <blockquote style="margin-left: 1em; border-left: 2px solid #d0d0d0; padding-left: 10px;">
  <pre style="{{precss}}">{{review.body_top}}</pre>
 </blockquote>
{%  endif %}
{%  for reply_review in review.public_replies %}
{%   if reply_review.body_top %}
{%    if reply_review != reply %}
 <p>On {{reply_review.timestamp|date:"F jS, Y, P T"}}, <b>{{reply_review.user|user_displayname}}</b> wrote:</p>
 <blockquote style="margin-left: 1em; border-left: 2px solid #d0d0d0; padding-left: 10px;">
  <pre style="{{precss}}">{{reply_review.body_top}}</pre>
 </blockquote>
{%    endif %}
{%   endif %}
{%  endfor %}
{%  if review.body_top %}
</blockquote>
{%  endif %}
<pre style="{{precss}}">{{reply.body_top}}</pre>
<br />
{% endif %}

{% for comment in reply.file_attachment_comments.all %}
<blockquote style="margin: 1em 0 0 1em; border-left: 2px solid #d0d0d0; padding-left: 10px;">
 <p style="margin-top: 0;">On {{review.time_emailed|date:"F jS, Y, P T"}}, <b>{{review.user|user_displayname}}</b> wrote:</p>
 <blockquote style="margin-left: 1em; border-left: 2px solid #d0d0d0; padding: 0 0 0 1em;">
  {# Prevents a display glitch on the table in Outlook 2007 #}
  <br style="display: none;" />

  <table bgcolor="#f0f0f0" cellpadding="5" cellspacing="5" style="border: 1px solid #c0c0c0; margin-bottom: 10px">
   <tr>
    <td><a href="{{domain_method}}://{{domain}}{{comment.file_attachment.get_absolute_url}}" style="color: black; font-weight: bold; font-size: 9pt;">{{comment.file_attachment.caption|default:comment.file_attachment.filename}}</a></td>
   </tr>
  </table>
  <pre style="{{precss}}">{{comment.reply_to.text}}</pre>
 </blockquote>
{%  for reply_comment in comment.reply_to.public_replies %}
{%   if reply_comment.text %}
{%    if reply_comment != comment %}
 <p>On {{reply_comment.timestamp|date:"F jS, Y, P T"}}, <b>{{reply_comment.review.get.user|user_displayname}}</b> wrote:</p>
 <blockquote style="margin: 1em 0 0 1em; border-left: 2px solid #d0d0d0; padding: 0 0 0 1em;">
  <pre style="{{precss}}">{{reply_comment.text}}</pre>
 </blockquote>
{%    endif %}
{%   endif %}
{%  endfor %}
</blockquote>
<pre style="margin-left: 1em; {{precss}}">{{comment.text}}</pre>
<br />
{% endfor %}

{% for comment in reply.screenshot_comments.all %}
<blockquote style="margin: 1em 0 0 1em; border-left: 2px solid #d0d0d0; padding-left: 10px;">
 <p style="margin-top: 0;">On {{review.time_emailed|date:"F jS, Y, P T"}}, <b>{{review.user|user_displayname}}</b> wrote:</p>
 <blockquote style="margin-left: 1em; border-left: 2px solid #d0d0d0; padding: 0 0 0 1em;">
  {# Prevents a display glitch on the table in Outlook 2007 #}
  <br style="display: none;" />

  <table bgcolor="#f0f0f0" cellpadding="5" cellspacing="5" style="border: 1px solid #c0c0c0; margin-bottom: 10px">
   <tr>
    <td><a href="{{domain_method}}://{{domain}}{{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="{{domain_method}}://{{domain}}{{comment.screenshot.get_absolute_url}}"><img src="{{domain_method}}://{{domain}}{{comment.get_image_url}}" style="border: 1px black solid;" alt="{{comment.screenshot.caption}}"></a></td>
   </tr>
  </table>
  <pre style="{{precss}}">{{comment.reply_to.text}}</pre>
 </blockquote>
{%  for reply_comment in comment.reply_to.public_replies %}
{%   if reply_comment.text %}
{%    if reply_comment != comment %}
 <p>On {{reply_comment.timestamp|date:"F jS, Y, P T"}}, <b>{{reply_comment.review.get.user|user_displayname}}</b> wrote:</p>
 <blockquote style="margin: 1em 0 0 1em; border-left: 2px solid #d0d0d0; padding: 0 0 0 1em;">
  <pre style="{{precss}}">{{reply_comment.text}}</pre>
 </blockquote>
{%    endif %}
{%   endif %}
{%  endfor %}
</blockquote>
<pre style="margin-left: 1em; {{precss}}">{{comment.text}}</pre>
<br />
{% endfor %}

{% for entry in comment_entries %}
<blockquote style="margin-left: 1em; border-left: 2px solid #d0d0d0; padding-left: 10px;">
 <p style="margin-top: 0;">On {{review.time_emailed|date:"F jS, Y, P T"}}, <b>{{review.user|user_displayname}}</b> wrote:</p>
 <blockquote style="margin-left: 1em; border-left: 2px solid #d0d0d0; padding-left: 10px;">
  {{entry.html|safe}}
  <pre style="{{precss}}">{{entry.comment.reply_to.text}}</pre>
 </blockquote>
{%  for reply_comment in entry.comment.reply_to.public_replies %}
{%   if reply_comment.text %}
{%    if reply_comment != entry.comment %}
 <p>On {{reply_comment.timestamp|date:"F jS, Y, P T"}}, <b>{{reply_comment.review.get.user|user_displayname}}</b> wrote:</p>
 <blockquote style="margin-left: 1em; border-left: 2px solid #d0d0d0; padding-left: 10px;">
  <pre style="{{precss}}">{{reply_comment.text}}</pre>
 </blockquote>
{%    endif %}
{%   endif %}
{%  endfor %}
</blockquote>
<pre style="margin-left: 1em; {{precss}}">{{entry.comment.text}}</pre>
<br />
{% endfor %}

{% if reply.body_bottom %}
{%  if review.body_bottom %}
<blockquote style="margin-left: 1em; border-left: 2px solid #d0d0d0; padding-left: 10px;">
 <p style="margin-top: 0;">On {{review.time_emailed|date:"F jS, Y, P T"}}, <b>{{review.user|user_displayname}}</b> wrote:</p>
 <blockquote style="margin-left: 1em; border-left: 2px solid #d0d0d0; padding-left: 10px;">
  <pre style="{{precss}}">{{review.body_bottom}}</pre>
 </blockquote>
{%  endif %}
{%  for reply_review in review.public_replies %}
{%   if reply_review.body_bottom %}
{%    if reply_review != reply %}
 <p>On {{reply_review.timestamp|date:"F jS, Y, P T"}}, <b>{{reply_review.user|user_displayname}}</b> wrote:</p>
 <blockquote style="margin-left: 1em; border-left: 2px solid #d0d0d0; padding-left: 10px;">
  <pre style="{{precss}}">{{reply_review.body_bottom}}</pre>
 </blockquote>
{%    endif %}
{%   endif %}
{%  endfor %}
{%  if review.body_bottom %}
</blockquote>
{%  endif %}
<pre style="{{precss}}">{{reply.body_bottom}}</pre>
<br />
{% endif %}

<p>- {% if reply.user.first_name != "" %}{{reply.user.first_name}}{% else %}{{reply.user.username}}{% endif %}</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 %}
