{% load i18n %}
<div class="panel panel-default">
  <div class="panel-heading">
    <span class="btn btn-default btn-xs infobtn pull-right" data-container="body" title="{% trans "List of VM templates that are available for you. You can create new ones from scratch or customize existing ones (preferred)." %}">
      <i class="fa fa-info-circle"></i>
    </span>
    <h3 class="no-margin"><i class="fa fa-puzzle-piece"></i> {% trans "Templates" %}
    </h3>
  </div>
  <div class="list-group" id="template-list-view">
    <div id="dashboard-template-list">
      {% for t in templates %}
      <a href="{% url "dashboard.views.template-detail" pk=t.pk %}" class="list-group-item
        {% if forloop.last and templates|length < 5 %} list-group-item-last{% endif %}">
        <span class="index-template-list-name">
          <i class="fa fa-{{ t.os_type }}"></i> {{ t.name }}
        </span>
        <small class="text-muted index-template-list-system">{{ t.system }}</small>
        <div data-href="{% url "dashboard.views.vm-create" %}?template={{ t.pk }}" class="pull-right vm-create">
          <i data-container="body" title="{% trans "Start VM instance" %}" 
            class="fa fa-play"></i>
        </div>
        <div class="clearfix"></div>
      </a>
      {% empty %}
        <div class="list-group-item">
          <div class="alert alert-warning" style="margin: 10px;">
            <p>
              {% trans "You don't have any templates, however you can still start virtual machines and even save them as new templates!" %}
            </p>
          </div>
        </div>
      {% endfor %}
    </div>
    <div class="list-group-item list-group-footer">
      <div class="row">
        <div class="col-xs-5 col-sm-6">
          <form action="{% url "dashboard.views.template-list" %}" method="GET" id="dashboard-template-search-form">
            <div class="input-group input-group-sm">
              <input name="s" type="text" class="form-control" placeholder="{% trans "Search..." %}" />
              <div class="input-group-btn">
                <button type="submit" class="btn btn-primary"><i class="fa fa-search"></i></button>
              </div>
            </div>
          </form>
        </div>
        <div class="col-xs-7 col-sm-6 text-right">
          <a href="{% url "dashboard.views.template-list" %}" class="btn btn-primary btn-xs">
            <i class="fa fa-chevron-circle-right"></i> {% trans "show all" %}
          </a>
        </div>
      </div>
    </div>
  </div>
</div>
