box.html 6.77 KB
Newer Older
1 2 3
{% extends "box/base/box.html" %}
{% load i18n %}
{% load l10n %}
4
{% load staticfiles %}
5 6 7 8 9 10 11 12
{% get_current_language as LANGUAGE_CODE %}

{% block title %}
    {% trans "Templates" %}
{% endblock title %}

{% block boxhelp %}
<div class="boxhelp">
Dányi Bence committed
13 14 15 16 17 18 19 20 21 22 23
    <div class="help">
        <div class="icon">
            <img src="{% static "icons/information-frame.png" %}" alt="{% trans "Help" %}" />
        </div>
        <div class="boxhelp-box">
            <p>{% blocktrans %}This is the list of your own templates.{% endblocktrans %}</p>
            <p>{% blocktrans %}Templates are customized versions of the base images.{% endblocktrans %}</p>
            <p>{% blocktrans %}You can install all the needed software on a master
            machine, and it will be ready to run by your students in minutes.
            {% endblocktrans %}</p>
        </div>
24
    </div>
Dányi Bence committed
25 26
    <div class="icon">
        <img src="" alt="toggle" title="{% trans "Show/hide box" %}" class="toggle-box" data-id="templates" id="toggle-box-templates"/>
27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61
    </div>
</div>
{% endblock %}

{% block content %}
<ul class="vm-list entry-list" id="template">
    {% for t in mytemplates %}
        {% include "box/template/entry.html" %}
    {% endfor %}

    {% if not mytemplates and not group %}
    <div class="tooltip">
        <div class="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 class="tail"></div>
        </div>
    </div>
    {% endif %}
    {% if not group %}
    <li id="new-template-button" class="entry new small-row">
        <div class="summary">
            <div class="name">Új Sablon</div>
            <div class="clear"></div>
        </div>
    </li>
    {% endif %}
    {% if publictemplates %}
        {% for t in publictemplates %}
            <li class="entry" id="t{{t.id }}">
                <div class="summary public-template">
                    <div class="name">
                        {{t.name}}
62
                        <img src="{% static "icons/lock-small.png" %}" alt="{% trans "locked" %}"
63 64 65 66 67 68
                         title="{% trans "This is a shared template." %}" />
                    </div>
                    <div class="status">{{t.state}}</div>
                    <div class="actions">
                        {% if t.state == 'READY' %}
                        <a href="#" class="try-template-button" data-id="{{t.id}}" title="{% trans "Try"  %}">
69
                            <img src="{% static "icons/control.png" %}" alt="{% trans "Start" %}"/>
70 71
                        </a>
                        <a href="#" class="template-share" data-id="{{t.id}}" data-gid="{{group.id}}" title="{% trans "Share" %}">
72
                            <img src="{% static "icons/user-share.png" %}" alt="{% trans "Share" %}" />
73 74 75 76 77 78 79 80 81 82 83
                        </a>
                        {% endif %}
                    </div>
                    <div class="clear"></div>
                    {% 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>
84
                            <form action="{% url one.views.vm_unshare i.id %}" method="post">
85
                                <span title="{{i.name}}">{{i.name|truncatechars:20}}</span>
Dányi Bence committed
86
                                ({{i.get_running}}/{{i.instance_limit}}) {{i.type}}
87
                                <a href="#" class="edit" data-id="{{i.id}}">
88
                                    <img src="{% static "icons/pencil.png" %}" alt="{% trans "Edit" %}" title="{% trans "Edit" %}" />
89 90
                                </a>
                                {% csrf_token %}
91 92 93 94
                                <input type="submit" class="template-unshare" value="{% trans "Delete" %}" style="float: right"/>
                            </form>
                            <div class="clear"></div>
                        </li>
95
                        <li class="description{% if not i.description %} empty{% endif %}">
96 97 98 99 100 101
                            {% if i.description %}
                                {{i.description}}
                            {% else %}
                                {% trans "No description available" %}
                            {% endif %}
                        </li>
102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153
                        {% endfor %}
                    </ul>
                    {% endif %}
                </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="entry small">
        <div class="summary">
            <div class="quota">
                <div class="used" style="background-color: rgba(0,255,0,0.2); width: {{userdetails.get_share_pc|unlocalize}}%"></div>
            </div>
            <div class="name">
                {% blocktrans with used=userdetails.get_weighted_share_count all=userdetails.share_quota %}Share quota: {{used}}/{{all}}{% endblocktrans %}
            </div>
            <div class="clear"></div>
        </div>
    </li>
</ul>
{% endblock content %}