{% extends "view_page.html" %}
{% load my_tags %}

{% block table_data %} 

<table cellspacing="0" class="infolist surname" width="95%">
<thead>
  <tr>
    <th>#</th>
    <th>ID</th>
    <th>Event Type</th>
    <th>Description</th>
    <th>Date</th>
    <th>Place</th>
  </tr>
</thead>
<tbody>
  {% for event in page.object_list %}
  <tr class="{% cycle odd,even %}">
    <td>{{ forloop.counter|row_count:page }}</td>
    <td><a href="/{{view}}/{{event.handle|escape}}{{args}}" class="noThumb browsecell">
           <span class="grampsid">[{{event.gramps_id}}]</span></a>

    {% if user.is_authenticated or event.public %}
    <td><a href="/{{view}}/{{event.handle|escape}}{{args}}" class="browsecell">{{event.event_type|nbsp}}</a>
    <td><a href="/{{view}}/{{event.handle|escape}}{{args}}" class="browsecell">{{event.description|nbsp}}</a>
    <td><a href="/{{view}}/{{event.handle|escape}}{{args}}" class="browsecell">{{event|date_as_text:user}}</a>
    <td><a href="/{{view}}/{{event.handle|escape}}{{args}}" class="browsecell">{{event.place.title|nbsp}}</a>
    {% else %}
      <td><a href="/{{view}}/{{event.handle|escape}}{{args}}" class="browsecell">[Private]</a>
      <td><a href="/{{view}}/{{event.handle|escape}}{{args}}" class="browsecell">[Private]</a>
      <td><a href="/{{view}}/{{event.handle|escape}}{{args}}" class="browsecell">[Private]</a>
      <td><a href="/{{view}}/{{event.handle|escape}}{{args}}" class="browsecell">[Private]</a>
    {% endif %}
  </tr>
  {% endfor %}
</tbody>
</table>

{% endblock %}

{% block admin_functions %}
{% if user.is_superuser %}
   <div style="background-color: lightgray; padding: 2px 0px 0px 2px">
   {% make_button "+Add Event" "/event/add" args %}
   </div>
{% endif %}
{% endblock %}