{% extends "tcms_base.html" %}
{% load static %}

{% block subtitle %} {{ test_plan.name }}{% endblock %}

{% block custom_stylesheet %}
<link rel="stylesheet" type="text/css" href="{% static "style/print.css" %}" media="print" />
{% endblock %}

{% block custom_javascript %}
<script type="text/javascript" src="{% static "js/testplan_actions.js" %}"></script>
<script type="text/javascript" src="{% static "js/testcase_actions.js" %}"></script>
<script type="text/javascript" src="{% static "js/nitrate.attachments.js" %}"></script>
<script type="text/javascript">
Nitrate.Utils.after_page_load(Nitrate.TestPlans.Attachment.on_load);
Nitrate.Utils.after_page_load(Nitrate.Attachments.on_load);
</script>
{% endblock %}

{% block contents %}

<div id="content">
	<div class="sprites crumble">
		<a href="{% url "nitrate-index" %}">Home</a>
		>> <a href="{% url "plans-all" %}?is_active=on">Planning</a>
		>> <a href="{{ test_plan.get_absolute_url }}">{{ test_plan.name }}</a>
		>> Add Attachment
	</div>
	<h2 id="display_title" style="line-height:1.2em;">{{ test_plan.name }}</h2>
	<div class="Detailform border-1">
		<form action="{% url "upload-file" %}" method="POST" enctype="multipart/form-data">{% csrf_token %}
			<div class="mixbar">
				<span class="tit">Upload New Attachment</span>
				<input type="hidden" name="to_plan_id" value="{{ test_plan.pk }}" />
				<input type="file" name="upload_file" id="upload_file" limit="{{ limit }}"/>
				<input type="submit" value="Upload" />
				<input type="button" class="js-back-button" value="Back" />
				<span class="right-action">Note: Each attachment size limit is {{ limit_readable }}.</span>
			</div>
		</form>

		{% include "plan/attachments_table.html" with attachments=test_plan.attachments.all from="from_plan" object_id=test_plan.pk %}
	</div>
</div>

{% endblock %}
