{% extends "box/base/summary.html" %}
{% load i18n %}
{% load l10n %}
{% load staticfiles %}
{% get_current_language as LANGUAGE_CODE %}

{% block content %}
<div class="summary {% if t.state == 'NEW' or t.state == 'SAVING'%}unfinished{% endif %}">
    {{ block.super }}
    {% if t.myshares %}
    <ul class="shares">
        {% for i in t.myshares %}
        <li>
            <div class="quota">
                <div class="used" style="width: {{ i.get_instance_pc|unlocalize }}%"></div>
            </div>
            <form action="{% url one.views.vm_unshare i.id %}" method="post">
                <span title="{{i.name}}">{{i.name|truncatechars:20}}</span>
                    ({{i.get_running}}/{{i.instance_limit}}) {{i.type}}
                    <a href="#" class="edit" data-url="{% url ajax_share_edit_wizard id=i.id %}">
                        <img src="{% static "icons/pencil.png" %}" alt="{% trans "Edit" %}" title="{% trans "Edit" %}" />
                    </a>
                    {% csrf_token %}
                <input class="template-unshare" type="submit" value="{% trans "Delete" %}" style="float: right"/>
            </form>
            <div class="clear"></div>
        </li>
        <li class="description{% if not i.description %} empty{% endif %}">
            {% if i.description %}
                {{i.description}}
            {% else %}
                {% trans "No description available" %}
            {% endif %}
        </li>
        {% endfor %}
    </ul>
    {% endif %}
</div>
{% endblock content %}

{% block name %}
<div class="name">{{t.name}}</div>
{% endblock %}

{% block status %}
    {{t.state}}
{% endblock status %}

{% block actions %}
    <a href="#" class="edit-template" title="{% trans "Edit" %}" data-url="{% url one.views.ajax_template_edit_wizard id=t.id %}">
        <img src="{% static "icons/pencil.png" %}" alt="{% trans "Edit" %}" />
    </a>
    {% if t.state == 'READY' %}
    <a href="#" class="try-template" data-url="{% url one.views.vm_new_ajax template=t.id %}"  title="{% trans "Try"  %}">
        <img src="{% static "icons/control.png" %}" alt="{% trans "Start" %}"/>
    </a>
    <a href="#" class="template-share" data-id="{{t.id}}" data-gid="{{group.id}}" title="{% trans "Share" %}">
        <img src="{% static "icons/user-share.png" %}" alt="{% trans "Share" %}" />
    </a>
    {% endif %}
    <a href="#" class="delete-template" data-url="{% url one.views.ajax_template_delete %}" data-id="{{ t.id }}" data-name="{{ t.name }}" title="{% trans "Remove" %}">
        <img src="{% static "icons/minus-circle.png" %}" alt="{% trans "Remove" %}" />
    </a>
{% endblock actions %}
