{% extends "sentry/groups/details.html" %}

{% load i18n crispy_forms_filters staticfiles %}

{% block title %}{{ title }} | {{ block.super }}{% endblock %}

{% block inner %}
<div class="span12">
    <div class="page-header">
        <h3>{{ title }}</h3>
    </div>

    {% if form.non_field_errors %}
    <div class="alert alert-block alert-error">
        <ul>
            {% for error in form.non_field_errors %}
            <li>{{ error }}</li>
            {% endfor %}
        </ul>
    </div>
    {% endif %}


    <form id='create-issue' class="form-horizontal" action="" method="post">
        {% csrf_token %}
        <input type="hidden" name="next" value="{{ next }}" />
        <div class="form-fields">
            {{ form|crispy }}
            <p class="actions">
                {% block submit_button %}
                    <button type="submit" class="btn btn-primary">{% trans "Create issue" %}</button>
                {% endblock %}
            </p>
        </div>
    </form>
</div>
{% endblock %}

{% block css %}
    {{ block.super }}
    <link rel="stylesheet" href="{% static 'sentry_youtrack/styles.css' %}">
{% endblock %}

{% block scripts %}
    {{ block.super }}

    <script type="text/javascript" src="//cdnjs.cloudflare.com/ajax/libs/spin.js/1.3.2/spin.min.js"></script>
    <script type="text/javascript" src="{% static 'sentry_youtrack/scripts.js' %}"></script>
    <script type="text/javascript">
        var SAVE_AS_DEFAULT_BUTTON_MSG = "{% trans 'Save as default' %}";
    </script>

    {% block yt_issue_js %}
        {% if not request.POST %}
            <script>
                $(function(){
                    load_issue_form();
                });
            </script>
        {% endif %}
    {% endblock %}
{% endblock %}
