{% extends 'ftp_deploy/base.html' %}
{% load crispy_forms_tags %}
{% load staticfiles %}

{% block extrahead %}
    <script src="{% static "admin/js/jquery.js" %}"></script>
    <script src="{% static "admin/js/jquery.init.js" %}"></script>
    <script src="{% static "admin/js/urlify.js" %}"></script>
    <script src="{% static "admin/js/prepopulate.js" %}"></script>

    <script type="text/javascript">
         (function($) {
            $(window).load(function(){
                
                var field = {
                    id: '#{{ form.repo_slug_name.auto_id }}',
                    dependency_ids: ['#{{ form.repo_name.auto_id }}'],
                    dependency_list: ['{{ form.repo_name.name }}'],
                    maxLength: {{ form.repo_slug_name.field.max_length|default_if_none:"50" }}
                };
                $(field.id).addClass('prepopulated_field');
                $(field.id).data('dependency_list', field['dependency_list'])
                .prepopulate(field['dependency_ids'], field.maxLength);
            });
        })(django.jQuery);
    </script>

{% endblock extrahead %}

{% block content %}
    
    <div class="row">
        <div class="col-sm-8"><h2>{{title}}</h2></div>
        <div class="col-sm-4">
            <div class="pull-right">
                <a href="{% url 'ftpdeploy_dashboard' %}" class="btn btn-default">Dashboard</a>
                {% if service %} <a href="{% url 'ftpdeploy_service_manage' service.pk %}" class="btn btn-primary">Manage</a> {% endif %}
            </div>
        </div>
        <span class="clearfix"></span>
        <br>
    </div>
    <div class="row">
        <div class="col-sm-12">
            {% crispy form %}
        </div>
    </div>

{% endblock content %}