{% load djblets_utils i18n %}

<table class="sidebyside diff-error{% if file.newfile %} newfile{% endif %}"
       id="file{{file.filediff.id}}">
 <colgroup>
  <col class="left" />
  <col class="right" />
 </colgroup>
 <thead>
  <tr class="filename-row">
{% if comment %}
   <th colspan="2" class="filename">
    <a href="{{comment.get_absolute_url}}">{{comment.filediff.dest_file_display}}</a>
    <span class="diffrevision">
{% if comment.interfilediff %}
{%  blocktrans with comment.filediff.diffset.revision as revision1 and comment.interfilediff.diffset.revision as revision2 %}
     (Diff revisions {{revision1}} - {{revision2}})
{%  endblocktrans %}
{% else %}
{%  blocktrans with comment.filediff.diffset.revision as revision %}
     (Diff revision {{revision}})
{%  endblocktrans %}
{% endif %}
    </span>
{% else %}
   <th colspan="2">
    {% if file.index != None %}<a name="{{file.index}}">{% endif %}
    {{file.depot_filename}}
    {% if file.index != None %}</a>{% endif %}
    </th>
{% endif %}
  </tr>
{% if file.revision %}
  <tr class="revision-row">
   <th>{{file.revision}}</th>
   <th>{{file.dest_revision}}</th>
  </tr>
{% endif %}
 </thead>
 <tbody>
  <tr>
   <td colspan="2">
    <h2>
     <div class="rb-icon rb-icon-warning"></div>
     {% trans "There was an error displaying this diff." %}
    </h2>
{% if error %}
    <p>{{error}}</p>
{% endif %}
    <p>
{% blocktrans %}
     This may be a bug in the software, a temporary outage, or an issue
     with the format of your diff.
{% endblocktrans %}
    </p>
    <p>
{% url 'support' as support_url %}
{% blocktrans %}
     Please try again, and if you still have trouble,
     <a href="{{support_url}}">contact support</a>.
{% endblocktrans %}
    </p>
   </td>
  </tr>
{% if trace %}
  <tr>
   <td colspan="2">
{%  definevar "link_suffix" %}{{file.filediff.pk}}{% if comment %}-{{comment.pk}}{% endif %}{% enddefinevar %}
    <a id="diff-error-link-{{link_suffix}}" href="#"
       onclick="$('#diff-error-details-{{link_suffix}}').toggle(); return false;">{% trans "Details" %}</a>
   </td>
  </tr>
  <tr class="error-details" id="diff-error-details-{{link_suffix}}">
   <td colspan="2">
    <pre>{{trace}}</pre>
   </td>
  </tr>
{% endif %}
 </tbody>
</table>
