{% extends "base_admin.html" %}
{% load projecttags %}
{% load bootstrap %}

{% block scripts %}
{{ block.super }}
<script src="https://cdn.rawgit.com/google/code-prettify/master/loader/run_prettify.js"></script>
{% endblock %}

{% block title %}
    {{ block.super }} - File Preview
{% endblock %}

{% setting "MAIN_URL" as main_url %}

{% block breadcrumbs %}
<ul>
    <li><a href="{{ main_url }}/teacher/">Home</a></li>
    <li>
        <a href="{{ main_url }}/teacher/opensubmit/submission/?coursefilter={{ submission.assignment.course.pk }}">Submissions</a>
    </li>
    <li>
        <a href="{{ main_url }}/teacher/opensubmit/submission/{{ submission.pk }}/change/">{{ submission.pk }}</a>
    </li>
    <li>Preview</li>
</ul>
{% endblock %}

{% block content %}
<div class="page-header">
    <h1>File Preview</h1>
</div>

<div id="content-main">
	<div class="panel-group" id="accordion" role="tablist" aria-multiselectable="true">
		{% for file in submission.file_upload.previews %}
			  <div class="panel panel-default">
			    <div class="panel-heading" role="tab" id="heading{{forloop.counter}}">
			      <h4 class="panel-title">
			        <a role="button" data-toggle="collapse" data-parent="#accordion" href="#collapse{{forloop.counter}}" aria-expanded="false" aria-controls="collapse{{forloop.counter}}">
			          {{ file.name }}
			        </a>
			      </h4>
			    </div>
			    <div id="collapse{{forloop.counter}}" class="panel-collapse collapse in" role="tabpanel" aria-labelledby="heading{{forloop.counter}}">
			      <div class="panel-body">
			        	<pre class="{% if not file.is_code %}nocode{% endif%} prettyprint linenums"><code>{{ file.preview }}</code></pre>
			      </div>
			    </div>
			  </div>
		{% endfor %}
	</div>
</div>


{% endblock %}
