{% load i18n sizeformat parse_date %}

<div class="detail">
  <dl class="dl-horizontal">
    <dt>{% trans "Name" %}</dt>
    <dd data-display="{{ snapshot.name|default:snapshot.id }}">{{ snapshot.name }}</dd>
    <dt>{% trans "ID" %}</dt>
    <dd>{{ snapshot.id }}</dd>
    {% if snapshot.description %}
    <dt>{% trans "Description" %}</dt>
    <dd>{{ snapshot.description }}</dd>
    {% endif %}
    <dt>{% trans "Status" %}</dt>
    <dd>{{ snapshot.status|capfirst }}</dd>
    <dt>{% trans "Volume" %}</dt>
    <dd>
      <a href="{{ snapshot.volume_url }}">
        {% if volume.name %}
          {{ volume.name }}
        {% else %}
          {{ snapshot.volume_id }}
        {% endif %}
      </a>
    </dd>
  </dl>

  <h4>{% trans "Specs" %}</h4>
  <hr class="header_rule">
  <dl class="dl-horizontal">
    <dt>{% trans "Size" %}</dt>
    <dd>{{ snapshot.size }} {% trans "GiB" %}</dd>
    <dt>{% trans "Created" %}</dt>
    <dd>{{ snapshot.created_at|parse_date }}</dd>
  </dl>

  <h4>{% trans "Metadata" %}</h4>
  <hr class="header_rule">
  <dl class="dl-horizontal">
  {% if snapshot.metadata.items %}
      {% for key, value in snapshot.metadata.items %}
          <dt>{{ key }}</dt>
          <dd>{{ value }}</dd>
      {% endfor %}
  {% else %}
      <dd>{% trans "None" %}</dd>
  {% endif %}
  </dl>
</div>
