{% extends "base.html" %}

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

{% block submenu %}
    {% url motion_overview as url_motionoverview %}
    <h4>{% trans "Motions" %}</h4>
    <ul>
        <li class="{% if request.path == url_motionoverview %}selected{% endif %}"><a href="{% url motion_overview %}">{% trans "All motions" %}</a></li>
        {% if perms.motion.can_create_motion or perms.motion.can_manage_motion %}
            <li class="{% active request '/motion/new' %}"><a href="{%  url motion_new %}">{% trans "New motion" %}</a></li>
        {% endif %}
        {% if perms.motion.can_manage_motion %}
            <li class="{% active request '/motion/import' %}"><a href="{%  url motion_import %}">{% trans 'Import motions' %}</a></li>
        {% endif %}
        <li><a href="{% url print_motions %}"><img src="{% static 'images/icons/pdf.png' %}"> {% trans 'All motions as PDF' %}</a></li>
    </ul>

    {# second submenu #}
    {% if motion %}
        <br>
        <h3>{% trans "Motion No." %}
            {% if motion.number != None %}
                {{ motion.number }}
            {% else %}
                <i>[-]</i>
            {% endif %}
        </h3>
        <ul>
        {# view motion #}
            {% url motion_view motion.id as url_motionview %}
            <li class="{% if request.path == url_motionview %}selected{% endif %}"><a href="{% url motion_view motion.id  %}">{% trans 'View motion' %}</a></li>
        {# edit motion #}
            {% if "edit" in actions %}
            {% url motion_edit motion.id as url_motionedit %}
            <li class="{% if request.path == url_motionedit %}selected{% endif %}"><a href="{% url motion_edit motion.id  %}"><img src="{% static 'images/icons/edit.png' %}"> {% trans 'Edit motion' %}</a></li>
            {% endif %}
        {# delete motion #}
            {% if "delete" in actions %}
            <li><a href="{% url motion_delete motion.id  %}"><img src="{% static 'images/icons/delete.png' %}"> {% trans 'Delete motion' %}</a></li>
            {% endif %}
        {# PDF #}
            <li><a href="{% url print_motion motion.id  %}"><img src="{% static 'images/icons/pdf.png' %}"> {% trans 'Motion as PDF' %}</a></li>
        {# activate and polls #}
            {% if perms.projector.can_manage_projector %}
                <li>
                    <a class="activate_link {% if item.active %}active{% endif %}" href="{% url projector_activate_slide motion.sid  %}"><img src="{% static 'images/icons/projector.png' %}"> {% trans 'Show Motion' %}</a>
                </li>
            {% endif %}
            {% if perms.motion.can_manage_motion %}
                {% for poll in motion.polls %}
                    {% url motion_poll_view poll.id as url_motionpollview %}
                    <li class="{% if request.path == url_motionpollview %}selected{% endif %}"><a href="{% url motion_poll_view poll.id %}"><img src="{% static 'images/icons/edit.png' %}"> {{ forloop.counter }}. {% trans "Vote" %}</a></li>
                {% endfor %}
            {% endif %}
        {# Agenda Item #}
            {% if perms.agenda.can_manage_agenda %}
            <li>
                <a href="{% url motion_create_agenda motion.id  %}">{% trans 'New agenda item' %}</a>
            </li>
            {% endif %}
        </ul>
    {% endif %}
{% endblock %}
