Commit 1519d326 by Kálmán Viktor

Merge branch 'feature-names' into 'master'

Feature display full names

Closes #161
parents 090b6ac7 d8a77c1b
{% load i18n %}
{% if user.get_full_name|length > 0 %}
{{ user.get_full_name }}
{% else %}
{{ user.username }}
{% endif %}
{% if show_org %}
{% if user.profile and user.profile.org_id|length > 0 %}
({{ user.profile.org_id }})
{% else %}
({% trans "username" %}: {{ user.username }})
{% endif %}
{% endif %}
...@@ -50,7 +50,13 @@ ...@@ -50,7 +50,13 @@
<thead><tr><th></th><th>{% trans "Who" %}</th><th>{% trans "Remove" %}</th></tr></thead> <thead><tr><th></th><th>{% trans "Who" %}</th><th>{% trans "Remove" %}</th></tr></thead>
{% for i in users %} {% for i in users %}
<tr> <tr>
<td><i class="icon-user"></i></td><td>{{i.username}}</td> <td>
<i class="icon-user"></i>
</td>
<td>
<strong>{{i.username}}</strong>,
{% include "dashboard/_display-name.html" with user=i show_org=True %}
</td>
<td> <td>
<a data-group_pk="{{ group.pk }}" data-member_pk="{{i.pk}}" href="{% url "dashboard.views.remove-user" member_pk=i.pk group_pk=group.pk %}" class="real-link delete-from-group btn btn-link btn-xs"><i class="icon-remove"><span class="sr-only">{% trans "remove" %}</span></i></a> <a data-group_pk="{{ group.pk }}" data-member_pk="{{i.pk}}" href="{% url "dashboard.views.remove-user" member_pk=i.pk group_pk=group.pk %}" class="real-link delete-from-group btn btn-link btn-xs"><i class="icon-remove"><span class="sr-only">{% trans "remove" %}</span></i></a>
</td> </td>
...@@ -83,7 +89,13 @@ ...@@ -83,7 +89,13 @@
<tbody> <tbody>
{% for i in acl.users %} {% for i in acl.users %}
<tr> <tr>
<td><i class="icon-user"></i></td><td>{{i.user}}</td> <td>
<i class="icon-user"></i>
</td>
<td>
<strong>{{i.user}}</strong>,
{% include "dashboard/_display-name.html" with user=i.user show_org=True %}
</td>
<td> <td>
<select class="form-control" name="perm-u-{{i.user.id}}"> <select class="form-control" name="perm-u-{{i.user.id}}">
{% for id, name in acl.levels %} {% for id, name in acl.levels %}
......
...@@ -8,7 +8,10 @@ ...@@ -8,7 +8,10 @@
{% if user.is_superuser %}<a href="{{ a.get_absolute_url }}">{% endif %} {% if user.is_superuser %}<a href="{{ a.get_absolute_url }}">{% endif %}
{{ a.get_readable_name }}{% if user.is_superuser %}</a>{% endif %} {{ a.get_readable_name }}{% if user.is_superuser %}</a>{% endif %}
</strong> </strong>
{{ a.started|date:"Y-m-d H:i" }}{% if a.user %}, {{ a.user }}{% endif %} {{ a.started|date:"Y-m-d H:i" }}
{% if a.user %},
{% include "dashboard/_display-name.html" with user=a.user show_org=True %}
{% endif %}
{% if a.is_abortable_for_user %} {% if a.is_abortable_for_user %}
<form action="{{ a.instance.get_absolute_url }}" method="POST" class="pull-right"> <form action="{{ a.instance.get_absolute_url }}" method="POST" class="pull-right">
{% csrf_token %} {% csrf_token %}
......
...@@ -62,7 +62,9 @@ ...@@ -62,7 +62,9 @@
<td class="pk"><div id="vm-{{i.pk}}">{{i.pk}}</div> </td> <td class="pk"><div id="vm-{{i.pk}}">{{i.pk}}</div> </td>
<td class="name"><a class="real-link" href="{% url "dashboard.views.detail" i.pk %}">{{ i.name }}</a> </td> <td class="name"><a class="real-link" href="{% url "dashboard.views.detail" i.pk %}">{{ i.name }}</a> </td>
<td class="state">{{ i.get_status_display }}</td> <td class="state">{{ i.get_status_display }}</td>
<td>{{ i.owner }}</td> <td>
{% include "dashboard/_display-name.html" with user=i.owner show_org=True %}
</td>
{% if user.is_superuser %} {% if user.is_superuser %}
<td data-sort-value="{{ i.node.normalized_name }}">{{ i.node.name|default:"-" }}</td> <td data-sort-value="{{ i.node.normalized_name }}">{{ i.node.name|default:"-" }}</td>
{% endif %} {% endif %}
......
...@@ -861,14 +861,9 @@ class GroupAclUpdateView(AclUpdateView): ...@@ -861,14 +861,9 @@ class GroupAclUpdateView(AclUpdateView):
logger.warning('Tried to set permissions of %s by non-owner %s.', logger.warning('Tried to set permissions of %s by non-owner %s.',
unicode(instance), unicode(request.user)) unicode(instance), unicode(request.user))
raise PermissionDenied() raise PermissionDenied()
name = request.POST['perm-new-name']
if (User.objects.filter(username=name).count() + self.set_levels(request, instance)
Group.objects.filter(name=name).count() < 1 self.add_levels(request, instance)
and len(name) > 0):
warning(request, _('User or group "%s" not found.') % name)
else:
self.set_levels(request, instance)
self.add_levels(request, instance)
return redirect(reverse("dashboard.views.group-detail", return redirect(reverse("dashboard.views.group-detail",
kwargs=self.kwargs)) kwargs=self.kwargs))
......
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