{% extends "sveedocuments/board/subbase_pages.html" %}
{% load i18n djangocodemirror_inputs crispy_forms_tags autobreadcrumb %}

{% block head_base_js %}{{ block.super }}
    {% get_current_language as LANGUAGE_CODE %}
    {% include "sveedocuments/board/includes/djangocodemirror_content_assets.html" %}
    <script type="text/javascript">
    //<![CDATA[
    DCM_lang = "{{ LANGUAGE_CODE }}";
    $(document).ready(function() {
        var picker = new Pikaday({
            field: $('#id_published_0')[0],
            //format: 'YYYY-MM-DD',
            format: 'DD/MM/YYYY',
            i18n: {
                months        : ['{% trans "January" %}','{% trans "February" %}','{% trans "March" %}','{% trans "April" %}','{% trans "May" %}','{% trans "June" %}','{% trans "July" %}','{% trans "August" %}','{% trans "September" %}','{% trans "October" %}','{% trans "November" %}','{% trans "December" %}'],
                weekdays      : ['{% trans "Sunday" %}','{% trans "Monday" %}','{% trans "Tuesday" %}','{% trans "Wednesday" %}','{% trans "Thursday" %}','{% trans "Friday" %}','{% trans "Saturday" %}'],
                weekdaysShort : ['{% trans "Sun" %}','{% trans "Mon" %}','{% trans "Tue" %}','{% trans "Wed" %}','{% trans "Thu" %}','{% trans "Fri" %}','{% trans "Sat" %}']
            }
        });
        
        $("#id_slug").slugify("#id_title");
        
        {% if page_instance %}DJANGOCODEMIRROR_OBJECT = {
            'id': {{ page_instance.id }},
            'slug': '{{ page_instance.slug }}'
        };{% endif %}
        
        var content_codemirror_instance = $('#{{ form.content.auto_id }}').djangocodemirror({{ form.content|djangocodemirror_init_input }});
    });
    //]]>
    </script>
{% endblock %}

{% block board_content %}
    <h2>{% current_title_from_breadcrumbs %}</h2>

    {% if page_instance and page_instance.visible %}{% include "sveedocuments/board/includes/page_form_subnav.html" with active_tab="edit" %}{% endif %}
    
    {% crispy form %}
{% endblock %}
