Commit 00bb4f06 by Dányi Bence

webui: shared templates

parent 4d01cc66
......@@ -161,6 +161,13 @@
}
}
.shares {
margin-left: 40px;
li {
height: 30px;
position: relative;
}
}
@placeholderColor: #555;
input::-webkit-input-placeholder{
color: @placeholderColor;
......
......@@ -6,25 +6,41 @@
{% 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}}
{% if t.myshares %}
<ul>
{% for i in t.myshares %}
<li>{{i.name}} -&gt; {{i.group}} ({{i.get_running}}/{{i.instance_limit}} = {{i.get_instance_pc}}%)
<form style="display:inline" action="/vm/unshare/{{i.id}}/" method="post">{% csrf_token %}<input type="submit" value="unshare"/></form>
</li>
{% endfor %}
{% 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="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}}" data-gid="{{group.id}}" title="{% trans "Share" %}"><img src="/static/icons/user-share.png" alt="{% trans "Share" %}" /></a>
{% endif %}
<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>
</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 }}%"></div>
</div>
<form action="/vm/unshare/{{i.id}}/" method="post">
<span title="{{i.name}}">{{i.name|truncatechars:20}}</span>
({{i.get_running}}/{{i.instance_limit}} = {{i.get_instance_pc}}%)
{% csrf_token %}
<input type="submit" value="unshare" style="float: right"/>
</form>
<div class="clear"></div>
</li>
{% endfor %}
</ul>
{% endif %}
</div>
<div class="details">
<ul>
......@@ -67,23 +83,34 @@
{% for t in publictemplates %}
<li class="wm" id="t{{t.id }}">
<div class="summary public-template">
<div class="name">{{t.name}}
{% if t.myshares %}
<ul>
{% for i in t.myshares %}
<li>{{i.name}} -&gt; {{i.group}} ({{i.get_running}}/{{i.instance_limit}} = {{i.get_instance_pc}}%)
<form style="display:inline" action="/vm/unshare/{{i.id}}/" method="post">{% csrf_token %}<input type="submit" value="unshare"/></form>
</li>
{% endfor %}
{% 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="#" 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 %}
</div>
<div class="clear"></div>
{% if t.myshares %}
<ul class="shares">
{% for i in t.myshares %}
<li>
<form action="/vm/unshare/{{i.id}}/" method="post">
<span title="{{i.name}}">{{i.name|truncatechars:20}}</span>
({{i.get_running}}/{{i.instance_limit}} = {{i.get_instance_pc}}%)
{% csrf_token %}
<input type="submit" value="unshare" style="float: right"/>
</form>
<div class="clear"></div>
</li>
{% endfor %}
</ul>
{% endif %}
</div>
<div class="details">
<ul>
......
......@@ -84,7 +84,8 @@
{% endif %}
{% endfor %}
{% include "box-templatelist.html" %}
{% include "box-grouplist.html" %}
</div>
{% include "box-filelist.html" %}
{% include "box-grouplist.html" %}
{% endblock %}
......@@ -77,12 +77,12 @@
</ul>
<nav>
<input type="reset" class="prev" value="{% trans "Cancel" %}" />
<input type="submit" value="{% trans "Share" %}" {% if not groups %} disabled=""{%endif%}/>
<input type="submit" value="{% trans "Share" %}" {% if not groups %}{%endif%}/>
<div class="clear"></div>
</nav>
<script type="text/javascript">
$(function(){
{% if not group %}
{% if not group %}
if (!$("select#share-group-select :selected").val())
$('#new-share input[type=submit]').attr("disabled", "")
else
......@@ -94,7 +94,6 @@
$('#new-share input[type=submit]').removeAttr("disabled")
})
{% endif %}
$('#new-share nav .prev').click(function(){
$('#modal').hide();
})
......
......@@ -3,9 +3,9 @@
{% get_current_language as LANGUAGE_CODE %}
{% block content %}
<div class="boxes">
<div class="contentblock">
<!-- <div class="contentblock">
<h2>Summary</h2>
</div>
</div> -->
<div class="contentblock" id="group-members">
<h2>{% trans "Members" %}</h2>
<ul class="wm-list">
......@@ -31,7 +31,7 @@
{% if not member.user %}
{% trans "This user never logged in, no data available" %}
{% else %}
{{member}} ({{member.code}})
{{member}} ({{member.code}}) <a href="mailto:{{member.user.email}}">E-mail</a>
{% endif %}
</div>
</div>
......@@ -52,18 +52,18 @@
</div>
<div class="boxes">
{% if noshare %}
<div id="new-wm-tooltip" style="position:absolute">
<div id="new-wm-tooltip-container">
<p>
{% trans "This group has no shared templates." %}
</p>
<p>
{% trans "Share one, and the group members can start their own virtual machine." %}
</p>
<div id="new-wm-tooltip-tail"></div>
</div>
<div id="new-wm-tooltip" style="position:absolute">
<div id="new-wm-tooltip-container">
<p>
{% trans "This group has no shared templates." %}
</p>
<p>
{% trans "Share one, and the group members can start their own virtual machine." %}
</p>
<div id="new-wm-tooltip-tail"></div>
</div>
{% endif %}
{% include "box-templatelist.html" %}
</div>
{% endif %}
{% include "box-templatelist.html" %}
</div>
{% endblock %}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment