box-templatelist.html 8.49 KB
Newer Older
1
{% load i18n %}
Őry Máté committed
2
{% load l10n %}
3
{% get_current_language as LANGUAGE_CODE %}
Dányi Bence committed
4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
<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">
                    {% if t.state == 'READY' %}
                    <a href="#" class="try-template-button" 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>
Dányi Bence committed
23
                    {% endif %}
Dányi Bence committed
24 25 26
                    <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>
27
                </div>
Dányi Bence committed
28 29 30 31 32 33 34 35 36 37
                <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>
                        <form action="/vm/unshare/{{i.id}}/" method="post">
                            <span title="{{i.name}}">{{i.name|truncatechars:20}}</span>
38
                                ({{i.get_running}}/{{i.instance_limit}})
Dányi Bence committed
39
                                {% csrf_token %}
40
                            <input class="unshare" type="submit" value="{% trans "Delete" %}" style="float: right"/>
Dányi Bence committed
41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58
                        </form>
                        <div class="clear"></div>
                    </li>
                    {% 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}}:
59 60 61
                            <span class="cpu">{{t.instance_type.CPU}}</span>
                            <span class="memory">{{t.instance_type.RAM}}</span>
                            <span class="credit">{{t.instance_type.credit}}</span>
Dányi Bence committed
62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81
                        </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 %}
82

Őry Máté committed
83
            {% if not mytemplates and not group %}
Dányi Bence committed
84 85 86 87 88 89 90 91 92 93
        <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 %}
Őry Máté committed
94
            {% if not group %}
Dányi Bence committed
95 96 97 98 99 100 101
        <li id="new-template-button" class="wm new">
            <div class="summary">
                <div class="name">Új Sablon</div>
                <div class="clear"></div>
            </div>
        </li>
        {% endif %}
102 103
            {% if publictemplates %}
            {% for t in publictemplates %}
Dányi Bence committed
104 105 106 107 108 109 110 111 112 113 114 115
        <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">
                    {% if t.state == 'READY' %}
                    <a href="#" class="try-template-button" data-id="{{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>
Dányi Bence committed
116
                    {% endif %}
117
                </div>
Dányi Bence committed
118 119 120 121 122 123 124 125 126 127
                <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>
                        <form action="/vm/unshare/{{i.id}}/" method="post">
                            <span title="{{i.name}}">{{i.name|truncatechars:20}}</span>
128
                            ({{i.get_running}}/{{i.instance_limit}})
Dányi Bence committed
129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148
                                {% csrf_token %}
                            <input type="submit" value="{% trans "Delete" %}" style="float: right"/>
                        </form>
                        <div class="clear"></div>
                    </li>
                    {% 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}}:
149 150 151
                            <span class="cpu">{{t.instance_type.CPU}}</span>
                            <span class="memory">{{t.instance_type.RAM}}</span>
                            <span class="credit">{{t.instance_type.credit}}</span>
Dányi Bence committed
152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171
                        </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 %}
172
            {% endif %}
Dányi Bence committed
173 174 175 176 177 178 179
        <li class="wm 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 %}
180
                </div>
Dányi Bence committed
181 182 183 184 185
                <div class="clear"></div>
            </div>
        </li>
    </ul>
</div>