{% extends "base.html" %}
{% load bootstrap %}

{% block title %}
    {{ block.super }} - New Submission
{% endblock %}

{% block docready %}
$('#id_authors').multiselect({
   enableFiltering: true,
   enableCaseInsensitiveFiltering: true,
});
$('#id_authors').multiselect('select', {{ user.pk }});
{% endblock %}

{% block content %}
<div class="page-header">
    <h1>
        New Submission
        <br/>
        <small>{{ assignment }} ({{ assignment.course }})</small>
    </h1>
</div>

<div class="row">
    <div class="col-md-12">
        <div class="well">
            <h4>Please note:</h4>
            {% if assignment.attachment_is_tested %} Your file attachment is automatically tested for validity. You can find further information in the <a href="{{ assignment.download }}">assignment description</a>.
            <br/>Invalid submissions are not accepted for grading. You will be informed by eMail.
            <br/>A valid upload fulfills at least the following conditions:
            <ul>
                <li>The uploaded file is a TGZ or ZIP archive.</li>
                {% if assignment.attachment_test_compile %}
                <li>After unpacking, a 'make' call can be issued to build the sources.</li>
                {% endif %} {% if assignment.attachment_test_validity %}
                <li>After successful building, the application can be verified with the <a href="{% url 'download' assignment.pk 'validity_testscript'%}">test script.</a>.</li>
                {% endif %}
            </ul>
            The following test machines will be used for this assignment:
            <ul class="list">
            {% for machine in  assignment.test_machines.all %}
             <li><a href="{% url 'machine' machine.pk %}">Test machine {{ machine.pk }}</a></li>
            {% endfor %}
            </ul>
            The console output and exit code for the compilation / test run is available in the submission details. {% else %} You can find further information in the <a href="{{ assignment.download }}">assignment description</a>. {% endif %} {% if assignment.max_authors > 1 %}
            <br/>A maximum of {{ assignment.max_authors }} author(s) is allowed. You are added automatically. {% endif %}
        </div>
    </div>
</div>

<div class="row">
    <div class="col-md-12">
        <form class="form" role="form" action="." method="post" enctype="multipart/form-data">
            {% csrf_token %} 
            {{ submissionForm|bootstrap }}
            <button type="submit" href="." class="btn btn-default"><span class="glyphicon glyphicon-ok"></span> Save</button>
        </form>
    </div>
</div>
{% endblock %}
