{% extends "base.html" %}

{% block page_title %}Create Spaces{% endblock %}

{% block content %}

<div class='space'>
    <form action="{% url 'space_create' %}" method="post">{% csrf_token %}
        {{ space_form.as_p }}
        <div id="protocol_form">{{ protocol_form.as_p|default:"" }}</div>
        <input type="submit" value="Create Space" class='btn btn-primary' />
    </form>
</div>
{% endblock %}

{% block extra_js %}
<script type="text/javascript">

$(document).ready(function () {
    $("#id_space-access_protocol").change(function () {
        protocol_val = $(this).val();
        $("#protocol_form").load(
            "{% url 'ajax_space_create_protocol_form' %}",
            {protocol: protocol_val});
    });
});

</script>
{% endblock %}
