Commit 44b50a55 by Dányi Bence

school: group listing

parent ce24f234
......@@ -463,3 +463,18 @@ table {
}
}
}
#group-members {
.summary .name {
background-image: url(icons/user.png);
}
}
#new-member {
.name {
background-image: url(icons/user--plus.png) !important;
}
#new-member-form {
display: none;
}
}
......@@ -2,5 +2,73 @@
{% load i18n %}
{% get_current_language as LANGUAGE_CODE %}
{% block content %}
Figyelem emberek!
<div class="boxes">
<div class="contentblock">
<h2>Summary</h2>
</div>
<div class="contentblock" id="group-members">
<h2>{% trans "Members" %}</h2>
<ul class="wm-list">
{% for member in members %}
<li class="wm small-row">
<div class="summary">
<div class="name">
{% if not member.user %}
{{member.code}}
{% else %}
{{member}} ({{member.code}})
{% endif %}
</div>
<div class="clear"></div>
</div>
<div class="details">
<div class="container">
{% if not member.user %}
{% trans "This user never logged in, no data available" %}
{% else %}
{{member}} ({{member.code}})
{% endif %}
</div>
</div>
</li>
{% endfor %}
<li class="wm small-row">
<div class="summary" id="new-member">
<div class="name">{% trans "Add user" %}</div>
<div id="new-member-form">
<input type="text" placeholder="{% trans "User NEPTUN code" %}" />
<input type="submit" value="{% trans "Add user" %}" />
</div>
<div class="clear"></div>
</div>
</li>
</ul>
</div>
</div>
<div class="boxes">
<div class="contentblock">
<h2>{% trans "Templates" %}</h2>
<ul class="wm-list">
<div id="new-wm-tooltip">
<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>
<li class="wm">
<div class="summary">
<div class="name">
{% trans "Sablon megosztása" %}
</div>
<div class="clear"></div>
</div>
</li>
</ul>
</div>
</div>
{% endblock %}
......@@ -142,7 +142,10 @@ def language(request, lang):
def group_show(request, gid):
user = request.user
group = get_object_or_404(Group, id=gid)
return render_to_response("show-group.html", RequestContext(request,{}))
return render_to_response("show-group.html", RequestContext(request,{
'group': group,
'members': group.members.all()
}))
def group_new(request):
name = request.POST['name']
......@@ -153,7 +156,7 @@ def group_new(request):
if re.match('^[a-zA-Z][a-zA-Z0-9]{5}$', member) == None:
messages.error(request, _('Invalid NEPTUN code found.'))
return redirect('/')
person = Person.objects.get_or_create(code=member)
person, created = Person.objects.get_or_create(code=member)
members.append(person)
owner = request.user.person_set.all()[0]
group = Group()
......@@ -161,7 +164,7 @@ def group_new(request):
group.semester = semester
group.save()
for member in members:
group.members.add(person)
group.members.add(member)
group.owners.add(owner)
group.save()
return redirect('/group/show/%s' % group.id)
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