Commit 1e29781e by Dányi Bence

school: group owners displayed

parent 20f132f9
......@@ -537,19 +537,19 @@ table {
}
}
#group-members {
#group-members, #group-owners {
.summary .name {
background-image: url(icons/user.png);
float: left;
}
}
#new-member {
#new-member, #new-owner {
.name {
background-image: url(icons/user--plus.png) !important;
float: left;
}
#new-member-form {
#new-member-form, #new-owner-form {
float: right;
margin-left: 5px;
display: none;
......
......@@ -279,6 +279,29 @@ $(function() {
alert(JSON.parse(data.responseText).status);
})
});
$('#new-owner').click(function() {
$('#new-owner-form').toggle();
});
$('#new-owner-form input').click(function(e) {
e.stopPropagation();
});
$('#new-owner-form input[type=submit]').click(function() {
var neptun = $(this).prev().val();
$.ajax({
type: 'POST',
url: '/ajax/group/' + $(this).data('id') + '/add/',
data: 'neptun=' + neptun,
dataType: 'json',
success: function(data) {
window.location.reload();
}
}).error(function(data) {
//TODO: fancy modal alert
alert(JSON.parse(data.responseText).status);
})
});
$('#group-members .remove').click(function(e) {
e.preventDefault();
e.stopPropagation();
......
......@@ -3,9 +3,6 @@
{% get_current_language as LANGUAGE_CODE %}
{% block content %}
<div class="boxes">
<!-- <div class="contentblock">
<h2>Summary</h2>
</div> -->
<div class="contentblock" id="group-members">
<h2>{% trans "Members of" %}: {{group.name}}</h2>
<ul class="wm-list">
......@@ -49,6 +46,49 @@
</li>
</ul>
</div>
<div class="contentblock" id="group-owners">
<h2>{% trans "Owners of" %}: {{group.name}}</h2>
<ul class="wm-list">
{% for owner in owners %}
<li class="wm small-row">
<div class="summary">
<div class="name">
{% if not owner.user %}
{{owner.code}}
{% else %}
{{owner}} ({{owner.code}})
{% endif %}
</div>
<div class="actions">
<a href="#" class="remove" data-gid="{{group.id}}" data-neptun="{{owner.code}}">
<img src="/static/icons/minus-circle.png" alt="{% trans 'Remove' %}" />
</a>
</div>
<div class="clear"></div>
</div>
<div class="details">
<div class="container">
{% if not owner.user %}
{% trans "This user never logged in, no data available" %}
{% else %}
{{owner}} ({{owner.code}}) <a href="mailto:{{owner.user.email}}">E-mail</a>
{% endif %}
</div>
</div>
</li>
{% endfor %}
<li class="wm small-row">
<div class="summary" id="new-owner">
<div class="name">{% trans "Add owner" %}</div>
<div id="new-owner-form">
<input type="text" placeholder="{% trans "Owner name/NEPTUN" %}" />
<input type="submit" value="{% trans "Add owner" %}" data-id="{{group.id}}"/>
</div>
<div class="clear"></div>
</div>
</li>
</ul>
</div>
</div>
<div class="boxes">
{% if noshare %}
......
......@@ -173,6 +173,7 @@ def group_show(request, gid):
'publictemplates': publictemplates,
'noshare': noshare,
'userdetails': UserCloudDetails.objects.get(user=request.user),
'owners': group.owners.all(),
}))
@login_required
......
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