{% extends "eukalypse_now/root.html" %}

{% load thumbnail %}

{% block base_content %}
<h1>{{testrun}}</h1>
<div class="well">
    <ul>
    <li><span class="label label-success">xxx</span>: no error, everything is fine</li>
    <li><span class="label label-important">xxx</span>: error</li>
    <li><span class="label label-warning">xxx</span>: acknowledged error; i know this error exists</li>
    <li><i class="icon-refresh"></i>: reference is updated</li>
    </ul>
</div>

<ul>
{% for testresult in testrun.testresult.all %}
    <li>
    {% if testresult.error %}
        <a class="anchor" data-ident="{{testresult.test.identifier}}" name="{{testresult.test.identifier}}" href="{{testresult.test.url}}">
            {% if testresult.error_acknowledged %}
                <span class="label label-warning">
            {% else %}
                <span class="label label-important">
            {% endif %}
            {{testresult.test.identifier}}</span>
        </a>
        {% if testresult.error_reference_updated %}
            <i class="icon-refresh"  rel="tooltip" title="reference is updated"></i>
        {% endif %}

        <br/>
        <ul class="thumbnails">
          <li class="span2"><a title="Reference"  class="thumbnail" rel="tooltip" href="{{testresult.referenceimage.url}}"><img  width="100" src="{{testresult.referenceimage|thumbnail_url:'detail'}}"></a>  </li>
          <li class="span2"><a title="Result"     class="thumbnail" rel="tooltip" href="{{testresult.resultimage.url}}"><img width="100" src="{{testresult.resultimage|thumbnail_url:'detail'}}"></a>  </li>
          <li class="span2"><a title="Error"      class="thumbnail" rel="tooltip" href="{{testresult.errorimage.url}}"><img width="100" src="{{testresult.errorimage|thumbnail_url:'detail'}}"></a>  </li>
          <li class="span2"><a title="Improved Error" class="thumbnail" rel="tooltip" href="{{testresult.errorimage_improved.url}}"><img width="100" src="{{testresult.errorimage_improved|thumbnail_url:'detail'}}"></a>  </li>
          <li class="span2">
            <div class="btn-group">
                {% if not testresult.error_reference_updated %}
                    <button class="btn ajaxcall" rel="tooltip" title="Use new created image as reference" data-ident="{{testresult.test.identifier}}" href="{{testresult.get_become_reference_url}}"><i class="icon-refresh"></i></button>
                {% endif %}
                {% if not testresult.error_acknowledged %}
                    <button class="btn ajaxcall" rel="tooltip" title="acknowledge this error" data-ident="{{testresult.test.identifier}}" href="{{testresult.get_acknowledge_error_url}}" ><i class="icon-ok"></i></button>
                {% endif %}

            </div>

                

          </li>
        </ul>
    {% else %}
        <a href="{{testresult.test.url}}"><span class="label label-success">{{testresult.test.identifier}}</span></a><br/>
        <ul class="thumbnails">
          <li class="span2"><a class="thumbnail" href="{{testresult.referenceimage.url}}"><img  width="100" src="{{testresult.referenceimage|thumbnail_url:'detail'}}"></a>  </li>
          <li class="span2"><a class="thumbnail" href="{{testresult.resultimage.url}}"><img width="100" src="{{testresult.resultimage|thumbnail_url:'detail'}}"></a>  </li>
        </ul>
    {% endif %}
    </li>
{% endfor %}
</ul>
{% endblock %}
