{% load i18n locale store_tags %}
<div id="timeline-results">
  <div class="extra-item-title">{% trans 'Timeline' %}</div>
  {% for entry_group in entries_group %}
  <div class="extra-item-block">
    <div class="extra-item-content">
      {% if entry_group.submitter %}
      <div class="extra-item-gravatar">
        {% include 'core/_avatar.html' with user=entry_group.submitter %}
      </div>
      {% endif %}
      <div class="extra-item">
        <div class="timeline-entry">
          {% for entry in entry_group.entries %}
          {% if entry.suggestion_text %}
          <div class="timeline-type-{{ entry.type }}">
            <div class="timeline-field-body">{{ entry.suggestion_text }}</div>
            <div class="sidetitle">{{ entry.suggestion_description }}</div>
          </div>
          {% elif entry.field > -1 %}
          <div class="timeline-field-{{ entry.field }}
            {% if entry.field == 4 %}js-editor-copy-comment{% endif %}
            {% if entry.field == 2 %}js-editor-copytext{% endif %}"
            {% if entry.field == 2 %} data-action="overwrite"{% endif %}
            data-string="{{ entry.new_value }}">
            {% if entry.field != 2 and entry.field != 0 %}
              {% if entry.field == 4 and entry.new_value != '' %}
              <span class="sidetitle">{{ entry.field_name }}:</span>
              {% endif %}
            {% endif %}
            {% if entry.field == 4 and entry.new_value == '' %}
              <span class="unit-empty">{% trans 'Last comment removed' %}</span>
            {% elif entry.field != 3 and entry.field != 0 %}
              <span class="timeline-field-body" lang="{{ language.code }}">{{ entry.new_value }}</span>
            {% elif entry.field == 0 %}
              {% if entry.check_name %}
                {{ entry.action }} <a href="{{ entry.checks_url }}#{{ entry.check_name }}">{{ entry.check_display_name}}</a> {% trans "check" %}
              {% endif %}
            {% else %}
              {{ entry.old_value }} <span class="timeline-arrow"></span> {{ entry.new_value }}
            {% endif %}
          </div>
          {% endif %}
          {% endfor %}
          {% if entry_group.created %}
            <div class="timeline-field-3">{% trans 'Unit created' %}</div>
          {% endif %}
        </div>
      </div>
      {% if entry_group.datetime %}
      <time class="extra-item-meta js-relative-date"
        title="{{ entry_group.datetime|dateformat }}"
        datetime="{{ entry_group.datetime.isoformat }}">&nbsp;</time>
      {% endif %}
    </div>
  </div>
  {% endfor %}
  </div>
</div>
