{% extends "sentry/bases/organization.html" %}

{% load i18n %}
{% load sentry_helpers %}

{% block title %}{% trans "Audit Log" %} | {{ block.super }}{% endblock %}

{% block org_auditlog_nav %}active{% endblock %}

{% block main %}

  <h3>Audit Log</h3>

  {% paginate audit_log_queryset from request as entry_list per_page 50 %}

  {% if entry_list.objects %}
    <p>{% blocktrans %}Sentry keeps track of important events within your organization.{% endblocktrans %}</p>

    <table class="table">
      <thead>
        <tr>
          <th>Member</th>
          <th>Action</th>
          <th>IP</th>
          <th>Time</th>
        </tr>
      </thead>
      <tbody>
        {% for entry in entry_list.objects %}
          <tr>
            <td class="table-user-info">
              {% if entry.actor %}
                <img class="avatar" src="{% gravatar_url entry.actor.email size 72 %}" />
              {% endif %}
              <h5>{{ entry.get_actor_name }}</h5>
              {{ entry.get_note }}
            </td>
            <td>{{ entry.get_event_display }}</td>
            <td>{{ entry.ip_address }}</td>
            <td>
              <span class="pretty-date" title="{{ entry.datetime|date:"c" }}Z">{{ entry.datetime|timesince }}</span>
            </td>
          </tr>
        {% endfor %}
      </tbody>
    </table>

    {{ event_list.paging }}
  {% else %}
    <div class="well">
      <p style="margin: 0;">It looks like nothing has really happened within your organization. Check back later!</p>
    </div>
  {% endif %}
{% endblock %}
