{% load base_filters %}
{% load base_tags %}
{% load event_tags %}
{% load perm_tags %}
{% load tagging_tags %}
{% load category_tags %}
{% load i18n %}

{% has_perm user events.change_event event as can_edit %}
{% has_perm user events.delete_event event as can_delete %}
{% has_perm user events.add_event as can_add %}
{% tags_for_object event as tags %}

<div class="meta {% if not user.is_authenticated %}anon{% endif %}">
    <div class="meta-left">

        {% if tags %}
        <div class="tags"><strong>{% trans "Tags:" %} </strong>
            {% for tag in tags %}
                <a href="{% url event.search %}?q=tag:{{ tag }}">{{ tag }}</a>{% if not forloop.last %}, {% endif %}
            {% endfor %}
        </div>
        {% endif %}
        
        {% if user.is_authenticated %}
        <div class="submitted">{% blocktrans with event.create_dt|date:"long" as create_date %}Created on {{ create_date }}
            by:{% endblocktrans %} <a href="{{ event.creator.get_absolute_url }}">
            {% if event.creator.first_name %}{{ event.creator.first_name }} {{ event.creator.last_name }}
            {% else %}
            {{ event.creator }}
            {% endif %}</a>
        </div>
        
        <div class="submitted">{% blocktrans with event.update_dt|date:"long" as update_date %}Last updated {{ update_date }}
            by:{% endblocktrans %} <a href="{{ event.owner.get_absolute_url }}">
            {% if event.owner.first_name %}{{ event.owner.first_name }} {{ event.owner.last_name }}
            {% else %}
            {{ event.owner }}
            {% endif %}</a>
        </div>
        {% endif %}
        
    </div>

    {% if user.is_authenticated %}    
        <div class="meta-right">
            <a class="print-link" href="{% url event.print_view event.pk %}">{% trans "Print" %}</a>
        </div>
    {% else %}
        <div>
            <a class="print-link" href="{% url event.print_view event.pk %}">{% trans "Print" %}</a>
        </div>
    {% endif %}

    <div style="clear:both;"></div>
</div>
{% if can_edit %}
<div class="editor-bar">

    <div class="perm-status">
    <ul>
        <li>{{ event.obj_perms }}</li>
        <li>{{ event.obj_status }}</li>
    </ul>
    </div>
    <div class="edit-links">
    <ul>
        <li><a class="eventlog-link" href="{% url event_log.search %}?object_id={{ event.pk }}&source={{ event.opt_app_label }}">{% trans "Eventlogs" %}</a></li>
        <li><a class="edit-link" href="{% url event.edit event.pk %}">{% trans "Edit" %}</a></li>
        <li><a class="options-link" href="#">{% trans "Options" %} <small>&#9650;</small></a>
        <div class="options-list">
            <ul>
            {% if can_delete %}
                <li>
                    <a class="delete" href="{% url event.delete event.pk %}">{% trans "Delete" %}</a>
                </li>               
            {% endif %}
            {% if request.user.is_superuser and event.status == 0 %}
                <li><a href="{% url event.approve event.pk %}">{% trans "Approve" %}</a></li>
            {% endif %}
            {% if can_add %}
                <li>
                    <a class="option-link copy" href="{% url event.copy event.pk %}">{% trans "Copy" %}</a>
                </li>
            {% endif %}
            <li><a href="{% url event.ics_single event.pk %}">{% trans "Export" %}</a></li>
            <li><a href="{% url event.edit.meta event.pk %}">{% trans "Edit Meta" %}</a></li>
            <li><a href="{% url event.registrant.search event.pk %}">{% trans "Registrants" %}</a></li>
            <li><a href="{% url event.registrant.roster event.pk %}">{% trans "Registrant Roster" %}</a></li>
            </ul>
        </div>
        </li>
    </ul>
    </div>
</div> 
{% endif %}
