{% extends "sentry/emails/base.html" %}

{% load sentry_helpers %}

{% block bodyclass %}digest{% endblock %}

{% block content %}

<div class="container" style="padding-top: 30px;">
  <h2>{{ counts|length }} new alert{{ counts|pluralize }} from <a href="{{ project.get_absolute_url }}">{{ project.name }}</a></h2>
  {% with start=start|date:"N j, Y, P e" end=end|date:"N j, Y, P e" %}
    <div class="dateline">{{ start }}{% if start != end %} to {{ end }}{% endif %}</div>
  {% endwith %}
</div>

{% for rule, groups in digest.iteritems %}

    <div class="rule">
      <div class="container">
        {{ rule.label }}
      </div>
    </div>

    <div class="container">
      <table class="event-list">
          <tr>
              <th colspan="2">Issue</th>
          </tr>
          {% for group, records in groups.items|slice:":10" %}
              <tr>
                  <td class="error-level">
                      <span class="level level-{{ group.get_level_display }}">{{ group.get_level_display }}</span>
                  </td>
                  <td class="event-detail">
                      {% include "sentry/emails/_group.html" %}
                      <p>
                        <small>{{ records.0.datetime|date:"N j, Y, g:i:s a e" }}</small>
                      </p>
                  </td>
              </tr>
          {% endfor %}
          {% with groups.items|slice:"10:" as remainder %}
            {% if remainder %}
                <tr>
                    <td colspan="3" class="more-events">
                        and {{ remainder|length }} more issue{{ remainder|pluralize }}
                    </td>
                </tr>
            {% endif %}
          {% endwith %}
      </table>
    </div>
{% endfor %}

{% endblock %}
