{% load i18n bob %}

{% if full_history_button %}
  <div>
    <h6>
      <a href="{{ history_for_model_url }}">{% trans "Full history" %}</a>
    </h6>
  </div>
{% endif %}

<div>
  <h5>{{ history_title }}</h5>
  {% if history %}
    <table class="table table-striped table-bordered details-history">
      <thead>
        <tr>
          <th>{% trans "Date" %}</th>
          <th>{% trans "Author" %}</th>
          {% if show_field_name %}
            <th>{% trans "Field" %}</th>
          {% endif %}
          <th>{% trans "Before" %}</th>
          <th>{% trans "After" %}</th>
        </tr>
      </thead>
      <tbody>
        {% for h in history %}
          <tr>
            <td>{{ h.date|timesince_limited }}</td>
            <td>{{ h.user|default:'' }}</td>
            {% if show_field_name %}
              <td>{{ h.field_name }}</td>
            {% endif %}
            <td>{{ h.old_value }}</td>
            <td>{{ h.new_value }}</td>
          </tr>
        {% endfor %}
      </tbody>
    </table>
  {% else %}
    <div class="alert alert-info">
      This object doesn't have any history.
    </div>
  {% endif %}
</div>
