{% load i18n %}
{% load translations %}

{% url 'project' project=object.slug as project_url %}

<ul class="nav nav-pills">
    {% if request.path != project_url %}
        <li><a href="{% url 'project' project=object.slug %}#components">{% trans "Components" %}</a></li>
        <li><a href="{% url 'project' project=object.slug %}#languages">{% trans "Languages" %}</a></li>
        <li><a href="{% url 'project' project=object.slug %}#information">{% trans "Info" %}</a></li>
        <li><a href="{% url 'project' project=object.slug %}#search">{% trans "Search" %}</a></li>
    {% else %}
        <li class="active"><a href="#components" data-toggle="tab">{% trans "Components" %}</a></li>
        <li><a href="#languages" data-toggle="tab">{% trans "Languages" %}</a></li>
        <li><a href="#information" data-toggle="tab">{% trans "Info" %}</a></li>
        <li><a href="#search" data-toggle="tab">{% trans "Search" %}</a></li>
    {% endif %}
    {% if request.path != project_url %}
        <li class="active"><a href="{% url 'show_dictionaries' project=object.slug %}">{% trans "Glossaries" %}</a></li>
    {% else %}
        <li><a href="{% url 'show_dictionaries' project=object.slug %}">{% trans "Glossaries" %}</a></li>
    {% endif %}
    <li class="dropdown">
        <a class="dropdown-toggle" data-toggle="dropdown" href="#">
        {% trans "Insights" %} <span class="caret"></span>
        </a>
        <ul class="dropdown-menu">
        {% if request.path != project_url %}
            <li><a href="{% url 'project' project=object.slug %}#history">{% trans "History" %}</a></li>
            <li><a href="{% url 'project' project=object.slug %}#activity" data-load="activity" data-yearly="{% url 'yearly_activity' project=object.slug %}" data-monthly="{% url 'monthly_activity' project=object.slug %}">{% trans "Activity" %}</a></li>
            <li><a href="{% url 'export_stats' project=object.slug %}?format=csv">{% trans "Download statistics (CSV)" %}</a></li>
            <li><a href="{% url 'export_stats' project=object.slug %}?format=json">{% trans "Download statistics (JSON)" %}</a></li>
            {% if user.is_authenticated %}
                <li><a href="{% url 'project' project=object.slug %}#reports">{% trans "Translation reports" %}</a></li>
            {% endif %}
        {% else %}
            <li><a href="#history" data-toggle="tab">{% trans "History" %}</a></li>
            <li><a href="#activity" data-toggle="tab" data-load="activity" data-yearly="{% url 'yearly_activity' project=object.slug %}" data-monthly="{% url 'monthly_activity' project=object.slug %}">{% trans "Activity" %}</a></li>
            <li><a href="{% url 'export_stats' project=object.slug %}?format=csv">{% trans "Download statistics (CSV)" %}</a></li>
            <li><a href="{% url 'export_stats' project=object.slug %}?format=json">{% trans "Download statistics (JSON)" %}</a></li>
            {% if user.is_authenticated %}
                <li><a href="#reports" data-toggle="tab">{% trans "Translation reports" %}</a></li>
            {% endif %}
        {% endif %}
        </ul>
    </li>
    <li class="dropdown">
        <a class="dropdown-toggle" data-toggle="dropdown" href="#">
        {% trans "Files" %} <span class="caret"></span>
        </a>
        <ul class="dropdown-menu">
        <li><a href="{% url "download_project"  project=object.slug %}?format=zip" title="{% trans "Download for offline translation." %}">{% blocktrans %}Download original translation files as ZIP file{% endblocktrans %}</a></li>
        </ul>
    </li>
    <li class="dropdown">
        <a class="dropdown-toggle" data-toggle="dropdown" href="#">
        {% trans "Tools" %} <span class="caret"></span>
        </a>
        <ul class="dropdown-menu">
        {% if request.path != project_url %}
            {% if replace_form %}
                <li><a href="{% url 'project' project=object.slug %}#replace">{% trans "Search and replace" %}</a></li>
            {% endif %}
            {% if bulk_state_form %}
                <li><a href="{% url 'project' project=object.slug %}#bulk-state">{% trans "Bulk status change" %}</a></li>
            {% endif %}
                <li><a href="{% url 'data_project' project=object.slug  %}">{% trans "Data exports" %}</a></li>
                <li><a href="{% url 'checks' %}?project={{ object.slug }}">{% trans "Failing checks" %}</a></li>
                <li><a href="{% url 'checks' %}?project={{ object.slug }}&amp;ignored=true">{% trans "Ignored checks" %}</a></li>
        {% else %}
            {% if replace_form %}
                <li><a href="#replace" data-toggle="tab">{% trans "Search and replace" %}</a></li>
            {% endif %}
            {% if bulk_state_form %}
                <li><a href="#bulk-state" data-toggle="tab">{% trans "Bulk status change" %}</a></li>
            {% endif %}
                <li><a href="{% url 'data_project' project=object.slug  %}">{% trans "Data exports" %}</a></li>
                <li><a href="{% url 'checks' %}?project={{ object.slug }}">{% trans "Failing checks" %}</a></li>
                <li><a href="{% url 'checks' %}?project={{ object.slug }}&amp;ignored=true">{% trans "Ignored checks" %}</a></li>
        {% endif %}
        </ul>
    </li>
    {% if user_can_manage_acl or user_can_edit_project or user_can_see_repository_status or user.is_authenticated %}
    <li class="dropdown">
        <a class="dropdown-toggle" data-toggle="dropdown" href="#">
        {% trans "Manage" %} <span class="caret"></span>
        </a>
        <ul class="dropdown-menu">
        {% if user_can_commit_translation %}
        <li><a href="{{ object.get_commit_url }}" class="link-post">{% trans "Commit" %}</a></li>
        {% endif %}
        {% if user_can_see_repository_status %}
            {% if request.path != project_url %}
                <li><a href="{% url 'project' project=object.slug %}#repository" data-href="{% url 'git_status_project' project=object.slug %}">{% trans "Repository maintenance" %}</a></li>
            {% else %}
                <li><a href="#repository" data-toggle="tab" data-href="{% url 'git_status_project' project=object.slug %}">{% trans "Repository maintenance" %}</a></li>
            {% endif %}
        <li role="separator" class="divider"></li>
        {% endif %}
        <li><a href="{% url 'memory' project=object.slug %}">{% trans "Translation memory" %}</a></li>
        {% if whiteboard_form %}
            {% if request.path != project_url %}
                <li><a href="{% url 'project' project=object.slug %}#whiteboard">{% trans "Add a project message" %}</a></li>
            {% else %}
                <li><a href="#whiteboard" data-toggle="tab">{% trans "Add a project message" %}</a></li>
            {% endif %}
        {% endif %}
        {% if user_can_manage_acl %}
        <li><a href="{% url 'manage-access' project=object.slug %}">{% trans "Users" %}</a></li>
        {% endif %}
        {% if user_can_edit_project %}
        <li><a href="{% url 'fonts' project=object.slug %}">{% trans "Fonts" %}</a></li>
        <li><a href="{% url 'settings' project=object.slug %}">{% trans "Settings" %}</a></li>
        {% endif %}
        {% if delete_form or rename_form %}
        <li role="separator" class="divider"></li>
        {% if request.path != project_url %}
            <li><a href="{% url 'project' project=object.slug %}#rename">{% trans "Rename" %}</a></li>
            <li><a href="{% url 'project' project=object.slug %}#delete">{% trans "Removal" %}</a></li>
        {% else %}
            <li><a href="#rename" data-toggle="tab">{% trans "Rename" %}</a></li>
            <li><a href="#delete" data-toggle="tab">{% trans "Removal" %}</a></li>
        {% endif %}
        {% endif %}
        </ul>
    </li>
    {% endif %}
    {% if enable_sharing %}
    <li class="dropdown">
        <a class="dropdown-toggle" data-toggle="dropdown" href="#">
        {% trans "Share" %} <span class="caret"></span>
        </a>
        <ul class="dropdown-menu">
    {% with object.get_share_url as share_url and object.get_widgets_url as widgets_url %}
        <li><a href="https://www.facebook.com/sharer.php?u={{ share_url }}">{% trans "Share on Facebook" %}</a></li>
        <li><a href="https://twitter.com/share?text={% blocktrans %}Translate {{ object }} using %23Weblate at {{ share_url }}!{% endblocktrans %}">{% trans "Tweet this translation" %}</a></li>
        <li><a href="{% url 'engage' project=object.slug %}">{% trans "Engage page" %}</a></li>
        <li><a href="{{ widgets_url }}">{% trans "Status widgets" %}</a></li>
    {% endwith %}
        </ul>
    </li>
    {% endif %}
</ul>