Commit a35c44b6 by tarokkk

webui: Added public template list

parent fc397c96
......@@ -131,6 +131,12 @@
background-color: rgb(135, 211, 120);
}
}
&.public-template{
background-color: rgb(167, 179, 195);
&:hover{
background-color: rgb(157, 169, 185);
}
}
&:hover{
background-color: #b1b1b1;
background-image: none;
......@@ -417,6 +423,9 @@
#template .wm .summary .name{
background-image: url(icons/document-template.png)
}
#template .wm .public-template .name{
background-image: url(icons/blue-document-share.png)
}
#new-template-button .name{
background-image: url(icons/document--plus.png) !important
}
......
......@@ -30,6 +30,8 @@
</div>
</li>
{% endfor %}
<!-- rgb(164, 179, 199) -->
{% if not mytemplates %}
<div id="new-wm-tooltip">
<div id="new-wm-tooltip-container">
......@@ -49,6 +51,33 @@
<div class="clear"></div>
</div>
</li>
{% 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="#" 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.instance_set.count}}</span></li>
</ul>
</div>
</li>
{% endfor %}
{% endif %}
<li class="wm small">
<div class="summary">
<div class="quota">
......
......@@ -75,6 +75,7 @@ def home(request):
return render_to_response("home.html", RequestContext(request, {
'templates': Template.objects.filter(state='READY'),
'mytemplates': Template.objects.filter(owner=request.user),
'publictemplates': Template.objects.filter(public=True),
'instances': _list_instances(request),
'groups': request.user.person_set.all()[0].owned_groups.all(),
'semesters': Semester.objects.all(),
......@@ -92,6 +93,8 @@ def ajax_template_delete(request):
return HttpResponse(unicode(_("There are running instances of this template.")), status=404)
elif template.share_set.exists():
return HttpResponse(unicode(_("Template is still shared.")), status=404)
elif template.owner != request.user:
return HttpResponse(unicode(_("You don't have permission to delete this template.")), status=404)
else:
template.safe_delete()
return HttpResponse(unicode(_("Template successfully deleted.")))
......
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