{% extends "base.html" %}

{% load tags %}
{% load i18n %}
{% load staticfiles %}

{% block header %}
    {{ block.super }}
    <link type="text/css" rel="stylesheet" media="all" href="{% static 'css/motion.css' %}" />
    <link type="text/css" rel="stylesheet" media="all" href="{% static 'css/ckeditor.css' %}" />
    <link href="{% static 'css/jquery.bsmselect.css' %}" type="text/css" rel="stylesheet" />
{% endblock %}

{% block javascript %}
    {{ block.super }}
    <script type="text/javascript" src="{% static 'js/ckeditor/ckeditor.js' %}"></script>
    <script type="text/javascript" src="{% static 'js/ckeditor-config.js' %}"></script>
    <script type="text/javascript" src="{% static 'js/jquery/jquery.bsmselect.js' %}"></script>
    <script type="text/javascript">
        // use jquery-bsmselect for all <select multiple> form elements
        $("select[multiple]").bsmSelect({
          removeLabel: '<sup><b>X</b></sup>',
          containerClass: 'bsmContainer',
          listClass: 'bsmList-custom',
          listItemClass: 'bsmListItem-custom',
          listItemLabelClass: 'bsmListItemLabel-custom',
          removeClass: 'bsmListItemRemove-custom'
        });

        // Init CKeditor
        $(function() {
            CKEDITOR.replace('id_text', ck_options);
            CKEDITOR.replace('id_reason', ck_options);
        });
    </script>
{% endblock %}

{% block title %}
    {% if motion %}
        {% trans "Edit motion" %}
    {% else %}
        {% trans "New motion" %}
    {% endif %}
    – {{ block.super }}
{% endblock %}

{% block content %}
    <h1>
        {% if motion %}
            {% trans "Edit motion" %}
        {% else %}
            {% trans "New motion" %}
        {% endif %}
        <small class="pull-right">
        {% if motion %}
            <a href="{{ motion|absolute_url }}" class="btn btn-mini"><i class="icon-chevron-left"></i> {% trans "Back to motion" %}</a>
        {% else %}
            <a href="{% url 'motion_list' %}" class="btn btn-mini"><i class="icon-chevron-left"></i> {% trans "Back to overview" %}</a>
        {% endif %}
        </small>
    </h1>
    <form action="" method="post">{% csrf_token %}
        {% include "form.html" %}
        <p>
        {% include "formbuttons_saveapply.html" %}
        <a href='{% url 'motion_list' %}' class="btn">
            {% trans 'Cancel' %}
        </a>
        </p>
        <small>* {% trans "required" %}</small>
    </form>
{% endblock %}
