{% load i18n %}
{% get_current_language as LANGUAGE_CODE %}
    <div class="contentblock" id="template">
        <h2>{% trans "Templates" %}</h2>
        <ul class="wm-list">
            {% for t in mytemplates %}
            <li class="wm" id="t{{t.id }}">
                <div class="summary {% if t.state == 'NEW' or t.state == 'SAVING'%}unfinished{% endif %}">
                    <div class="name">{{t.name}}</div>
                    <div class="status">{{t.state}}</div>
                    <div class="actions">
                        <a href="#" title="{% trans "Edit" %}"><img src="/static/icons/pencil.png" alt="{% trans "Edit" %}" /></a>
                        <a href="#" class="delete-template-button" data-id="{{ t.id }}" data-name="{{ t.name }}" title="{% trans "Remove" %}"><img src="/static/icons/minus-circle.png" alt="{% trans "Remove" %}" /></a>
                        <a href="#" class="template-share" data-id="{{t.id}}" title="{% trans "Share" %}"><img src="static/icons/user-share.png" alt="{% trans "Share" %}" /></a>
                    </div>
                    <div class="clear"></div>
                </div>
                <div class="details">
                    <ul>
                        <li class="name">{% trans "System" %}: <span class="value">{{t.system}}</span><div class="clear"></div></li>
                        <li class="type">{% trans "Size" %}: <span class="value">{{t.instance_type}}:
                            <span class="cpu">{{t.instance_type.CPU}}</span>
                            <span class="memory">{{t.instance_type.RAM}}</span>
                            <span class="credit">{{t.instance_type.credit}}</span>
                        </span></li>
                        <li class="description">{% trans "Description" %}: <span class="value">{{t.description}}</span><div class="clear"></div></li>
                        <li class="date" >{% trans "Created at" %}: <span class="value">{{t.created_at}} ({{t.owner.get_profile}})</span><div class="clear"></div></li>
                        <li class="count">{% trans "Running instances" %}: <span class="value">{{ t.running_instances }}</span></li>
                    </ul>
                </div>
            </li>
            {% endfor %}

            {% if not mytemplates and not group %}
                <div id="new-wm-tooltip">
                    <div id="new-wm-tooltip-container">
                        <p>
                            {% trans "You have no own templates." %}
                        </p>
                        <p>
                            {% trans "Create a new one, and share it with your students. Or you can also use a common one." %}
                        </p>
                        <div id="new-wm-tooltip-tail"></div>
                    </div>
                </div>
            {% endif %}
            {% if not group %}
            <li id="new-template-button" class="wm new">
                <div class="summary">
                    <div class="name">Új Sablon</div>
                    <div class="clear"></div>
                </div>
            </li>
            {% endif %}
            {% if publictemplates %}
            {% for t in publictemplates %}
            <li class="wm" id="t{{t.id }}">
                <div class="summary public-template">
                    <div class="name">{{t.name}}</div>
                    <div class="status">{{t.state}}</div>
                    <div class="actions">
                        <a href="#" class="template-share" data-id="{{t.id}}" {%if group%}data-gid="{{group.id}}"{%endif%} title="{% trans "Share" %}"><img src="static/icons/user-share.png" alt="{% trans "Share" %}" /></a>
                    </div>
                    <div class="clear"></div>
                </div>
                <div class="details">
                    <ul>
                        <li class="name">{% trans "System" %}: <span class="value">{{t.system}}</span><div class="clear"></div></li>
                        <li class="type">{% trans "Size" %}: <span class="value">{{t.instance_type}}:
                            <span class="cpu">{{t.instance_type.CPU}}</span>
                            <span class="memory">{{t.instance_type.RAM}}</span>
                            <span class="credit">{{t.instance_type.credit}}</span>
                        </span></li>
                        <li class="description">{% trans "Description" %}: <span class="value">{{t.description}}</span><div class="clear"></div></li>
                        <li class="date" >{% trans "Created at" %}: <span class="value">{{t.created_at}} ({{t.owner.get_profile}})</span><div class="clear"></div></li>
                        <li class="count">{% trans "Running instances" %}: <span class="value">{{t.running_instances}}</span></li>
                    </ul>
                </div>
            </li>
            {% endfor %}
            {% endif %}
            <li class="wm small">
                <div class="summary">
                    <div class="quota">
                        <div class="used" style="background-color: rgba(0,255,0,0.2); width: 19%"></div>
                    </div>
                    <div class="name">{% blocktrans with used=19 all=100 %}Share quota: {{used}}/{{all}}{% endblocktrans %}</div>
                    <div class="clear"></div>
                </div>
            </li>
        </ul>
    </div>
