{% 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-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" data-id="{{ t.id }}" title="{% trans "Edit" %}">
        <img src="{% static "icons/pencil.png" %}" alt="{% trans "Edit" %}" />
    </a>
    {% if t.state == 'READY' %}
    <a href="#" class="try-template" data-id="{{t.id}}" title="{% trans "Try"  %}">
        <img src="{% static "icons/control.png" %}" alt="{% trans "Start" %}"/>
    </a>
    <!--<a href="#" title="{% trans "Edit" %}">
        <img src="{% static "icons/pencil.png" %}" alt="{% trans "Edit" %}" />
    </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-id="{{ t.id }}" data-name="{{ t.name }}" title="{% trans "Remove" %}">
        <img src="{% static "icons/minus-circle.png" %}" alt="{% trans "Remove" %}" />
    </a>
{% endblock actions %}
