{% load i18n static sekizai_tags cms_tags %}{% spaceless %}

{% include "shop/djng-form.html" %}

{% if stylesheet_url %}{% addtoblock "css" %}<link href="{{ stylesheet_url }}" rel="stylesheet" type="text/css" />{% endaddtoblock %}{% endif %}

{% if many %}
	<p class="bg-warning">{% blocktrans %}
		Please embed this plugin into a <code>SegmentationPlugin</code> with condition <code>if not many</code>.
	{% endblocktrans %}</p>
{% else %}
	{% if show_history and data.extra.addendum %}
		<label>{% trans "Previous annotations" %}</label>
		<dl class="dl-horizontal">
		{% for timestamp, annotation in data.extra.addendum %}
			<dt shop-timestamp="{{ timestamp }}" time-format="d. MMM yyyy, HH:mm"></dt>
			<dd class="font-italic">{{ annotation }}</dd>
		{% endfor %}
		</dl>
	{% endif %}
	{% with instance_css_classes=instance.css_classes instance_inline_styles=instance.inline_styles %}
	<form name="{{ addendum_form.form_name }}" djng-endpoint="{{ request.path_info }}" novalidate>
		{{ addendum_form.as_div }}
		<button ng-click="do(create()).then(showOK()).then(delay(333)).then(reloadPage()).finally(restore())" ng-disabled="isDisabled()"{% if instance_css_classes %} class="{{ instance_css_classes }}"{% endif %}{% if instance_inline_styles %} style="{{ instance_inline_styles }}"{% endif %}>
			{{ icon_left }}{{ button_label }}{{ icon_right }}
		</button>
	</form>
	{% endwith %}
{% endif %}
{% endspaceless %}
