Update teams management
Update styling to use Bootstrap 4. Make current user status clear. Show member name as well as email address. Make permissions impler to set on team admin form.
This commit is contained in:
parent
bd42d0d997
commit
ef148ea482
2 changed files with 59 additions and 46 deletions
|
@ -4,37 +4,14 @@
|
|||
|
||||
{% block head_title %}{{ team.name }}{% endblock %}
|
||||
|
||||
{% block body_outer %}
|
||||
<div class="float-right">
|
||||
{% if can_join %}
|
||||
<form class="form-horizontal" method="post" action="{% url "team_join" team.slug %}">
|
||||
{% csrf_token %}
|
||||
<input type="submit" class="btn btn-primary" value="join">
|
||||
</form>
|
||||
{% endif %}
|
||||
|
||||
{% if can_leave %}
|
||||
<form class="form-horizontal" method="post" action="{% url "team_leave" team.slug %}">
|
||||
{% csrf_token %}
|
||||
<input type="submit" class="btn btn-secondary" value="leave">
|
||||
</form>
|
||||
{% endif %}
|
||||
|
||||
{% if can_apply %}
|
||||
<form class="form-horizontal" method="post" action="{% url "team_apply" team.slug %}">
|
||||
{% csrf_token %}
|
||||
<input type="submit" class="btn btn-primary" value="apply">
|
||||
</form>
|
||||
{% endif %}
|
||||
</div>
|
||||
{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
<div class="jumbotron">
|
||||
<h1>{{ team.name }}{% if state %} <span class="label">{{ state }}</span>{% endif %}</h1>
|
||||
<h1>{{ team.name }}</h1>
|
||||
|
||||
{% if team.description %}<p>{{ team.description }}</p>{% endif %}
|
||||
|
||||
<div>
|
||||
<h2>Your Status {% if state %} <span class="badge badge-pill badge-primary">{{ state }}</span>{% endif %}</h2>
|
||||
{% if state == "invited" %}
|
||||
<p>
|
||||
You have been invited to join this team.
|
||||
|
@ -45,15 +22,46 @@
|
|||
</p>
|
||||
{% endif %}
|
||||
|
||||
{% if can_join %}
|
||||
<p>
|
||||
You are <strong>not</strong> a member of this team.
|
||||
<form class="form-horizontal" method="post" action="{% url "team_join" team.slug %}">
|
||||
{% csrf_token %}
|
||||
<input type="submit" class="btn btn-primary" value="join">
|
||||
</form>
|
||||
</p>
|
||||
{% endif %}
|
||||
|
||||
{% if can_leave %}
|
||||
<p>
|
||||
You are a member of this team.
|
||||
<form class="form-horizontal" method="post" action="{% url "team_leave" team.slug %}">
|
||||
{% csrf_token %}
|
||||
<input type="submit" class="btn btn-secondary" value="leave">
|
||||
</form>
|
||||
</p>
|
||||
{% endif %}
|
||||
|
||||
{% if can_apply %}
|
||||
<p>
|
||||
You are <strong>not</strong> a member of this team.
|
||||
<form class="form-horizontal" method="post" action="{% url "team_apply" team.slug %}">
|
||||
{% csrf_token %}
|
||||
<input type="submit" class="btn btn-primary" value="apply">
|
||||
</form>
|
||||
</p>
|
||||
{% endif %}
|
||||
</div>
|
||||
|
||||
{% if user.is_staff or state == "manager" %}
|
||||
{% if team.managers %}
|
||||
<h2>Managers</h2>
|
||||
<table class="table table-striped">
|
||||
{% for membership in team.managers %}
|
||||
<tr>
|
||||
<td>{{ membership.user.email }}{% if user == membership.user %} <span class="label label-info">you</span>{% endif %}</td>
|
||||
<td>{{ membership.user.get_full_name }} <{{ membership.user.email }}>{% if user == membership.user %} <span class="badge badge-info">you</span>{% endif %}</td>
|
||||
<td>
|
||||
<form class="form-horizontal" style="margin: 0;" method="post" action="{% url "team_demote" membership.pk %}">{% csrf_token %}<button type="submit" class="btn btn-xs">demote</button></form>
|
||||
<form class="form-horizontal" style="margin: 0;" method="post" action="{% url "team_demote" membership.pk %}">{% csrf_token %}<button type="submit" class="btn btn-sm btn-primary">demote</button></form>
|
||||
</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
|
@ -64,9 +72,9 @@
|
|||
<table class="table table-striped">
|
||||
{% for membership in team.members %}
|
||||
<tr>
|
||||
<td>{{ membership.user.email }}{% if user == membership.user %} <span class="label label-info">you</span>{% endif %}</td>
|
||||
<td>{{ membership.user.get_full_name }} <{{ membership.user.email }}>{% if user == membership.user %} <span class="badge badge-info">you</span>{% endif %}</td>
|
||||
<td>
|
||||
<form class="form-horizontal" style="margin: 0;" method="post" action="{% url "team_promote" membership.pk %}">{% csrf_token %}<button type="submit" class="btn btn-xs">promote</button></form>
|
||||
<form class="form-horizontal" style="margin: 0;" method="post" action="{% url "team_promote" membership.pk %}">{% csrf_token %}<button type="submit" class="btn btn-sm btn-primary">promote</button></form>
|
||||
</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
|
@ -77,10 +85,10 @@
|
|||
<table class="table table-striped">
|
||||
{% for membership in team.applicants %}
|
||||
<tr>
|
||||
<td>{{ membership.user.email }}</td>
|
||||
<td>{{ membership.user.get_full_name }} <{{ membership.user.email }}></td>
|
||||
<td>
|
||||
<form class="form-horizontal" style="margin: 0; float: left;" method="post" action="{% url "team_accept" membership.pk %}">{% csrf_token %}<button type="submit" class="btn btn-xs">accept</button></form>
|
||||
<form class="form-horizontal" style="margin: 0; float: left;" method="post" action="{% url "team_reject" membership.pk %}">{% csrf_token %}<button type="submit" class="btn btn-xs">reject</button></form>
|
||||
<form class="form-horizontal" style="margin: 0; float: left;" method="post" action="{% url "team_accept" membership.pk %}">{% csrf_token %}<button type="submit" class="btn btn-sm btn-primary">accept</button></form>
|
||||
<form class="form-horizontal" style="margin: 0; float: left;" method="post" action="{% url "team_reject" membership.pk %}">{% csrf_token %}<button type="submit" class="btn btn-sm btn-secondary">reject</button></form>
|
||||
</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
|
@ -91,7 +99,7 @@
|
|||
<table class="table table-striped">
|
||||
{% for membership in team.invitees %}
|
||||
<tr>
|
||||
<td>{{ membership.user.email }}</td>
|
||||
<td>{{ membership.user.get_full_name }} <{{ membership.user.email }}></td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</table>
|
||||
|
|
9
vendor/symposion/teams/admin.py
vendored
9
vendor/symposion/teams/admin.py
vendored
|
@ -4,8 +4,13 @@ from reversion.admin import VersionAdmin
|
|||
|
||||
from symposion.teams.models import Team, Membership
|
||||
|
||||
admin.site.register(Team,
|
||||
prepopulated_fields={"slug": ("name",)})
|
||||
|
||||
class TeamAdmin(admin.ModelAdmin):
|
||||
prepopulated_fields={"slug": ("name",)}
|
||||
filter_horizontal = ('permissions', 'manager_permissions',)
|
||||
|
||||
|
||||
admin.site.register(Team, TeamAdmin)
|
||||
|
||||
|
||||
class MembershipAdmin(VersionAdmin):
|
||||
|
|
Loading…
Reference in a new issue