{% load events_tags %}
{% load avatar_tags %}


{% if not truncate %}
<h4>Event Detail</h4>
{% endif %}
<div class="event-unit" style="text-align:center;">

    <div class="event-head" style="height:30%;margin:0.3em;">
    {% if truncate %}
    <a href="{{event.get_absolute_url}}">{{event.title|truncatewords:7}}</a>
    {% else %}
    <h2>{{event.title}}</h2>
        by <a href="{{event.owner.get_absolute_url}}">{{event.owner}}
        </a>
    {% endif %}    
    </div>


    <div style="background:#fff;height:10%;font-size:80%;margin: 0.3em;padding:0.3em;">
        {{event.start|date:'f A, F j'}}
    </div>

    <div style="height:45%;padding:.25em;">
    {% if event.description %}
    {% if truncate %}
    {{ event.description|truncatewords:truncate }}
    {% else %}
    {{ event.description }}
    {% endif %}
    {% endif %}
    </div>

    {% if is_owner %}
    <div style="height:30px;width:50px; margin:0 auto;">
    <a href="{% url events_delete id=event.id %}"><img src="{{MEDIA_URL}}pinax/images/silk/icons/delete.png"></img></a>
    <a href="{% url events_change id=event.id %}"><img src="{{MEDIA_URL}}pinax/images/silk/icons/pencil.png"></img></a>
    </div>

    {% else %}
        {% if request.user.is_authenticated %}
            {% add_remove_event_relation event request.user %}
        {% endif %}
    {% endif %}

</div>

