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

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

        {% if story.tags %}
        <div class="tags">
            <strong>Tags: </strong>
            {% for tag in story.tags|tag_split %}
                <a href="{% url stories %}?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 == story.creator or user == story.owner %}
            <div class="categories">
                <strong>{% trans "Owned by you" %}</strong>{% if not story.status_detail == "active" %} - {% trans "status" %}: {{ story.obj_status }}{% endif %}
            </div>
            {% endif %}
            {% endif %}

            {% if user.profile.is_superuser or user == story.creator or user == story.owner %}
                {% meta_creator_owner story %}
            {% endif %}
        {% endif %}
    </div>
    
    <div class="meta-right">
        <a class="print-link" href="{% url story.print_details story.pk %}">{% trans "Print" %}</a>
    </div>
</div>

{% if user.profile.is_superuser %}
<div class="editor-bar">
    <div class="perm-status">
    <ul>
        <li>{{ story.obj_perms }}</li>
        <li>{{ story.obj_status }}</li>
        <li>{% story_expiration story %}</li>
    </ul>
    </div>
    <div class="edit-links">
    <ul>
        <li><a class="eventlog-link" href="{% url event_log.search %}?object_id={{ story.pk }}&source={{ story.opt_app_label }}">{% trans "Eventlogs" %}</a></li>
        <li><a class="edit-link" href="{% url story.edit story.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 story.delete story.pk %}">{% trans "Delete" %}</a></li>               
                <li><a href="{% url category.update story.opt_app_label story.opt_module_name story.pk %}">{% trans "Edit Categories" %}</a></li>
                
            </ul>
        </div>
        </li>
    </ul>
    </div>
</div>
{% endif %}
