<!--
Template for the Prototype edit and create view (can be used as both)
It has a security check, so that edit/delete are only visible to admins. (Usually only admins should see this though...)
-->
{% extends "html/achievements/page.html" %}

{% block title %}{% trans %}Achievements{% endtrans %}{% endblock %}
{% block module_subtitle %}Prototypes{% endblock %}

{% block module_topmenu %}
	<!-- we can only do anything with it if it exists -->
	{% if form.instance.id != None %}
		<a href="{% url achievements_prototype_detail form.instance.id %}" class="top-menu view-link view-link">{% trans %}View{% endtrans %}</a>
		{% if user.get_profile().is_admin(module_name='achievements') %}
			<a href="{% url achievements_prototype_edit form.instance.id %}" class="top-menu edit-link-active">{% trans %}Edit{% endtrans %}</a>
			<a href="{% url achievements_prototype_delete form.instance.id %}" class="top-menu delete-link">{% trans %}Delete{% endtrans %}</a>
		{% endif %}
	{% endif %}
{% endblock %}

{% block module_content %}
<form action="" method="post" class="content-form" enctype="multipart/form-data">
	{% csrf_token %}
		<ul class="content-form-fields">
			{{ form.as_ul()|htsafe }}
		</ul>
		<div class="content-form-submit">
			<!-- if in edit mode, it's save, in add mode it's create -->
			{% if form.instance.id != None %}
				<input type="submit" name="save" value="{% trans %}Save Prototype{% endtrans %}"/>
			{% else %}
				<input type="submit" name="save" value="{% trans %}Create Prototype{% endtrans %}"/>
			{% endif %}
			<input type="submit" name="cancel" value="{% trans %}Cancel{% endtrans %}" class="cancel" />
		</div>
</form>
{% endblock %}