{% extends 'localcosmos_server/modals/large_modal_form.html' %}
{% load i18n %}

{% block title %}{% if component %}{% blocktrans with name=form.component_template_name %}Manage {{ name }}{% endblocktrans %}{% else %}{% blocktrans with name=form.component_template_name %}Create {{ name }}{% endblocktrans %}{% endif %}{% endblock %}

{% block action %}
    {% if component %}
        {% url 'manage_component' app.uid localized_template_content.pk content_key component.uuid %}
    {% else %}
        {% url 'manage_component' app.uid localized_template_content.pk content_key %}
    {% endif %}
{% endblock %}

{% block footer %}
	{% include 'localcosmos_server/modals/footers/save_close.html' %}
{% endblock %}

{% block script %}
	{% if success %}
		<script>
			{% include 'template_content/ajax/reload_template_content_form_fields.html' %}

			$("#LargeModal").modal("hide");
			$("#LargeModalContent").empty();
			
		</script>
	{% endif %}
	<script>
		{% for field in form %}
			{% if field.name in form.layoutable_full_fields %}
				ClassicEditor.create( document.querySelector('#{{ field.auto_id }}'), {% include 'template_content/ckeditor/layout-complex.js' %});
			{% elif field.name in form.layoutable_simple_fields %}
				ClassicEditor.create( document.querySelector('#{{ field.auto_id }}'), {% include 'template_content/ckeditor/layout-simple.js' %});
			{% endif %}
		{% endfor %}
	</script>
{% endblock %}