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

<div class="{% if node.is_active_slide %}activeline{% endif %}">
    {% if perms.agenda.can_manage_agenda or perms.projector.can_manage_projector %}
    <div class="manage">
        <span style="width: 1px; white-space: nowrap;">
        {% if perms.projector.can_manage_projector %}
            <a href="{{ node|absolute_url:'projector' }}"
                class="activate_link btn {% if node.is_active_slide and active_type == 'text' %}btn-primary{% endif %} btn-mini"
                rel="tooltip" data-original-title="{% trans 'Show agenda item' %}">
                <i class="icon-facetime-video {% if node.is_active_slide and active_type == 'text' %}icon-white{% endif %}"></i>
            </a>
            <a href="{{ node|absolute_url:'projector_list_of_speakers' }}"
                class="activate_link btn btn-mini {% if node.is_active_slide and active_type == 'list_of_speakers' %}btn-primary{% endif %}"
                rel="tooltip" data-original-title="{% trans 'Show list of speakers' %}">
                <i class="icon icon-bell {% if node.is_active_slide and active_type == 'list_of_speakers' %}icon-white{% endif %}"></i>
            </a>
        {% endif %}
        {% if perms.agenda.can_manage_agenda %}
            <a href="{{ node|absolute_url:'update' }}" rel="tooltip" data-original-title="{% trans 'Edit' %}" class="btn btn-mini">
                <i class="icon-pencil"></i>
            </a>
            <a href="{{ node|absolute_url:'delete' }}" rel="tooltip" data-original-title="{% trans 'Delete' %}" class="btn btn-mini">
                <i class="icon-remove"></i>
            </a>
            <a href="{% if node.closed %}{% url 'item_open' node.id %}{% else %}{% url 'item_close' node.id %}{% endif %}"
                class="close_link btn btn-mini {% if node.closed %}btn-success{% endif %} tooltip-left"
                rel="tooltip" data-original-title="{% trans 'Change status (open/closed)' %}">
                <i class="{% if node.closed %}icon-checked-new{% else %}icon-unchecked-new{% endif %}"></i>
            </a>
            {% if not node.is_leaf_node %}
                <a href="{{ node|absolute_url:'projector_summary' }}"
                    class="activate_link btn btn-mini {% if node.is_active_slide and active_type == 'summary' %}btn-primary{% endif %}"
                    title="{% trans 'Show summary for this item' %}">
                    <i class="icon-summary {% if node.is_active_slide and active_type == 'summary' %}icon-white{% endif %}"></i>
                </a>
            {% endif %}
        {% endif %}
        </span>
    </div>
    {% endif %}

    {% if perms.agenda.can_see_orga_items %}
    <div class="duration">
        {% if node.duration %}
            {{ node.duration }} h
            {% if node.tooltip %}
                <a class="btn btn-mini" rel="tooltip" data-original-title="{% trans 'End' %}:
                {{ node.tooltip|date:"DATETIME_FORMAT" }}"><i class="icon-clock"></i>
                </a>
            {% endif %}
        {% endif %}
    </div>
    {% endif %}

    {% if perms.agenda.can_manage_agenda %}
    <div class="optional">
        {% if node.comment %}
            {{ node.comment|first_line }}
            <a class="btn btn-mini" rel="popover" data-content="{{ node.comment|linebreaks }}">
                <i class="icon icon-search"></i>
            </a>
        {% endif %}
    </div>
    {% endif %}

    <div class="opener_closer">
        <a class="opener btn btn-mini" rel="tooltip" data-original-title="{% trans 'Expand items' %}"><span class="icon-plus"></span></a>
        <a class="closer btn btn-mini" rel="tooltip" data-original-title="{% trans 'Collapse items' %}"><span class="icon-minus"></span></a>
    </div>

    <div class="title">
        <a class="closed" rel="tooltip" data-original-title="{% trans 'Item closed' %}">
            <i class="{% if node.closed %}icon-checked-new{% endif %}"></i>
        </a>
        {% with form=node.weight_form %}
            {{ form.weight }}
            {{ form.self }}
            {{ form.parent }}
        {% endwith %}
        <a href="{{ node|absolute_url }}">{% if node.type == node.ORGANIZATIONAL_ITEM %}<i>[{% endif %}{{ node }}{% if node.type == node.ORGANIZATIONAL_ITEM %}]</i>{% endif %}</a>
        {{ node.get_title_supplement|safe }}
    </div>
</div>
