{% load base_tags %}
{% load base_filters %}
{% load i18n %}

<div class="meta">
    <div class="meta-left">
        {% with directory.category_set as directory_cat %}
        {% if directory_cat.category %}
        <div class="categories">
            <strong>{% trans "Category:" %} </strong><a href="{% url directories %}?q=category:{{ directory_cat.category }}">{{ directory_cat.category }}</a>
            {% if directory_cat.sub_category %}
                | <strong>{% trans "Sub Category:" %} </strong><a href="{% url directories %}?q=sub_category:{{ directory_cat.sub_category }}">{{ directory_cat.sub_category }}</a>
            {% endif %}
        </div>
        {% endif %}
        {% endwith %}

        {% if directory.tags %}
        <div class="tags">
            <strong>Tags: </strong>
            {% for tag in directory.tags|tag_split %}
                <a href="{% url directories %}?q=tag:{{ tag }}">{{ tag }}</a>{% if not forloop.last %}, {% endif %}
            {% endfor %}
        </div>
        {% endif %}

        {% if user.is_authenticated %}
            {% if not user.profile.is_superuser %}
            {% if user == directory.creator or user == directory.owner %}
            <div class="categories">
                <strong>Owned by you</strong>{% if not directory.status_detail == "active" %} - status: {{ directory.obj_status }}{% endif %}
            </div>
            {% endif %}
            {% endif %}

            {% if user.profile.is_superuser or user == directory.creator or user == directory.owner %}
                {% meta_creator_owner directory %}
            {% endif %}
        {% endif %}
    </div>
    <div class="meta-right">
        <a class="print-link" href="{% url directory.print_view directory.slug %}">{% trans "Print" %}</a>
    </div>
</div>
{% if user.profile.is_superuser %}
<div class="editor-bar">

    <div class="perm-status">
    <ul>
        <li>{{ directory.obj_perms }}</li>
        <li>{{ directory.obj_status }}</li>
    </ul>
    </div>
    <div class="edit-links">
    <ul>
        <li><a class="eventlog-link" href="{% url event_log.search %}?object_id={{ directory.pk }}&source={{ directory.opt_app_label }}">{% trans "Eventlogs" %}</a></li>
        <li><a class="edit-link" href="{% url directory.edit directory.pk %}">{% trans "Edit" %}</a></li>
        <li><a class="options-link" href="#">{% trans "Options" %} <small>&#9650;</small></a>
        <div class="options-list">
            <ul>
                <li>
                    <a class="delete" href="{% url directory.delete directory.pk %}">{% trans "Delete" %}</a>
                </li>
                <li><a href="{% url directory.edit.meta directory.pk %}">{% trans "Edit Meta" %}</a></li>
                <li><a href="{% url category.update directory.opt_app_label directory.opt_module_name directory.pk %}">{% trans "Edit Categories" %}</a></li>
            </ul>
        </div>
        </li>
    </ul>
    </div>
</div> 
{% endif %}
