{% load i18n %}
{% load lfc_tags %}

<ul class="sf-menu">
    {% ifhasperm add %}
        <li>
        {% if display_content_menu %}
            <a>{% trans "Add" %}</a>
            <ul>
            {% for content_type in content_types %}
                <li>
                    <a href="{% url lfc_add_object obj.id %}?type={{ content_type.type }}">{% trans content_type.name %}</a>
               </li>
            {% endfor %}
            </ul>
        {% else %}
            {% for content_type in content_types %}
                <a href="{% url lfc_add_object obj.id %}?type={{ content_type.type }}">{% trans "Add" %}: {% trans content_type.name %}</a>
            {% endfor %}
        {% endif %}
        </li>
    {% endifhasperm %}
    {% if display_action_menu %}
        <li>
            <a>{% trans "Actions" %}</a>
            <ul>
                {% ifhasperm add %}
                <li>
                    <a href="{% url lfc_copy obj.id %}">{% trans 'Copy' %}</a>
                </li>
                {% endifhasperm %}
                {% ifhasperm delete %}
                    <li>
                        <a href="{% url lfc_cut obj.id %}">{% trans 'Cut' %}</a>
                    </li>
                {% endifhasperm %}
                {% if display_paste %}
                    {% ifhasperm add %}
                        <li>
                            <a href="{% url lfc_paste obj.id %}">{% trans 'Paste' %}</a>
                        </li>
                    {% endifhasperm %}
                {% endif %}
                {% ifhasperm delete %}
                    <li>
                        <a class="delete-link" href="{% url lfc_delete_object obj.id %}">{% trans 'Delete' %}</a>
                    </li>
                {% endifhasperm %}
            </ul>
        </li>
    {% endif %}
    {% if LFC_MULTILANGUAGE %}
    <li>
        {% if translations %}
            <a>{{ obj.get_language_display }}</a>
            <ul>
                <li>
                    <a {% ifequal canonical.language obj.language %}class="selected"{% endifequal %}
                       href="{% url lfc_manage_object canonical.id %}">
                        {{ canonical.get_language_display }}
                    </a>
                </li>
                {% for translation in translations %}
                    <li>
                        <a {% ifequal translation.language obj.language %}class="selected"{% endifequal %}
                            href="{% url lfc_manage_object translation.id %}">
                            {{ translation.get_language_display }}
                        </a>
                    </li>
                {% endfor %}
            </ul>
        {% endif %}
    </li>
    {% ifhasperm edit %}
        <li>
            {% if obj.is_canonical %}
                <a>{% trans 'Translate to' %}</a>
                <ul>
                    {% for language in languages %}
                        <li>
                            <a href="{% url lfc_translate_object obj.id language.code %}">{{ language.name }}</a>
                        </li>
                    {% endfor %}
                </ul>
            {% else %}
                {% if obj.canonical %}
                    <a>{% trans 'Translate to' %}</a>
                    <ul>
                        {% for language in languages %}
                        <li>
                            <a href="{% url lfc_translate_object obj.canonical.id language.code %}">{{ language.name }}</a>
                        </li>
                        {% endfor %}
                    </ul>
                {% endif %}
            {% endif %}
        </li>
    {% endifhasperm %}

    {% endif %}
    {% if state %}
        <li>
            <a>{% trans state.name %}</a>
            {% if transitions %}
                <ul>
                    {% for transition in transitions %}
                        <li>
                            <a href="{% url lfc_manage_do_transition obj.id %}?transition={{ transition.id }}">
                                {% trans transition.name %}
                            </a>
                        </li>
                    {% endfor %}
                </ul>
            {% endif %}
        </li>
    {% endif %}
    <li>
        <a accesskey="v"
           href="{{ obj.get_absolute_url }}">{% trans 'View' %}</a>
    </li>
</ul>
