fixup the team pages a bit, column names and stuff

This commit is contained in:
Thomas Steen Rasmussen 2017-05-25 19:56:34 +02:00
parent f4b2e55478
commit dd736066f7
2 changed files with 35 additions and 13 deletions

View file

@ -21,10 +21,10 @@ Teams | {{ block.super }}
<th>Name</th> <th>Name</th>
<th>Description</th> <th>Description</th>
<th>Responsible</th> <th>Responsible</th>
<th>Members</th> <th class="text-center">Members</th>
{% if request.user.is_authenticated %}
<th>Member?</th> <th>Member?</th>
{% if request.user in team.members.all or request.user in team.responsible.all %} <th>Actions</th>
<th>Actions</th>
{% endif %} {% endif %}
</tr> </tr>
</thead> </thead>
@ -39,17 +39,21 @@ Teams | {{ block.super }}
<td> <td>
{{ team.description|unsafecommonmark|truncatewords:50 }} {{ team.description|unsafecommonmark|truncatewords:50 }}
</td> </td>
<td> <td>
{% for resp in team.responsible.all %} {% for resp in team.responsible.all %}
{{ resp.profile.name|default:"Unnamed" }}{% if not forloop.last %},{% endif %}<br> {{ resp.profile.name|default:"Unnamed" }}{% if not forloop.last %},{% endif %}<br>
{% endfor %} {% endfor %}
</td> </td>
<td class="text-center"> <td class="text-center">
<span class="badge">{{ team.members.count }}</span> <span class="badge">{{ team.members.count }}</span><br>
{% if team.needs_members %}(more needed){% endif %}
</td> </td>
{% if request.user.is_authenticated %} {% if request.user.is_authenticated %}
{% membershipstatus request.user team as membership_status %}
<td class="text-center"> <td class="text-center">
{% membershipstatus request.user team as membership_status %}
{% if membership_status == 'Membership Pending' %} {% if membership_status == 'Membership Pending' %}
<i class='fa fa-clock-o' title='Pending'></i> <i class='fa fa-clock-o' title='Pending'></i>
{% else %} {% else %}
@ -60,24 +64,21 @@ Teams | {{ block.super }}
{% endif %} {% endif %}
{% endif %} {% endif %}
</td> </td>
<td> <td>
{% if request.user in team.members.all %} {% if request.user in team.members.all %}
<a href="{% url 'team_leave' camp_slug=camp.slug slug=team.slug %}" class="btn btn-danger"><i class="fa fa-minus"></i> Leave</a> <a href="{% url 'team_leave' camp_slug=camp.slug slug=team.slug %}" class="btn btn-danger"><i class="fa fa-minus"></i> Leave</a>
{% else %} {% else %}
{% if team.needs_members %} {% if team.needs_members %}
<a href="{% url 'team_join' camp_slug=camp.slug slug=team.slug %}" class="btn btn-success"><i class="fa fa-plus"></i> Join</a> <a href="{% url 'team_join' camp_slug=camp.slug slug=team.slug %}" class="btn btn-success"><i class="fa fa-plus"></i> Join</a>
{% else %}
<i>Team does not need members</i>
{% endif %} {% endif %}
{% endif %} {% endif %}
{% if request.user in team.responsible.all %} {% if request.user in team.responsible.all %}
<a href="{% url 'team_manage' camp_slug=camp.slug slug=team.slug %}" class="btn btn-primary"><i class="fa fa-cog"></i> Manage</a> <a href="{% url 'team_manage' camp_slug=camp.slug slug=team.slug %}" class="btn btn-primary"><i class="fa fa-cog"></i> Manage</a>
{% endif %} {% endif %}
</td>
{% else %}
<td>Login to join!</td>
{% endif %} {% endif %}
</td>
</tr> </tr>
{% endfor %} {% endfor %}
</tbody> </tbody>

View file

@ -21,35 +21,48 @@ Manage Team: {{ team.name }} | {{ block.super }}
</form> </form>
<h3>{{ team.name }} Team Members</h3> <h3>{{ team.name }} Team Members</h3>
{% if team.teammember_set.exists %}
<table class="table table-bordered table-hover"> <table class="table table-bordered table-hover">
<thead> <thead>
<tr> <tr>
<th> <th>
Profile Profile
</th>
<th> <th>
Name Name
</th>
<th> <th>
Email Email
</th>
<th> <th>
Description Description
</th>
<th> <th>
Membership Membership
</th>
<th> <th>
Action Action
</th>
</tr>
</thead>
<tbody> <tbody>
{% for membership in team.teammember_set.all %} {% for membership in team.teammember_set.all %}
<tr> <tr>
<td> <td>
{{ membership.user }} {{ membership.user }}
</td>
<td> <td>
{{ membership.user.profile.name }} {{ membership.user.profile.name }}
</td>
<td> <td>
{{ membership.user.profile.email }} {{ membership.user.profile.email }}
</td>
<td> <td>
{{ membership.user.profile.description }} {{ membership.user.profile.description }}
</td>
<td> <td>
{% if membership.approved %}member{% else %}pending{% endif %} {% if membership.approved %}member{% else %}pending{% endif %}
</td>
<td> <td>
{% if membership.approved %} {% if membership.approved %}
<a class="btn btn-danger" href="{% url 'teammember_remove' camp_slug=camp.slug pk=membership.id %}"><i class="fa fa-trash-o"></i> Remove</a> <a class="btn btn-danger" href="{% url 'teammember_remove' camp_slug=camp.slug pk=membership.id %}"><i class="fa fa-trash-o"></i> Remove</a>
@ -57,5 +70,13 @@ Manage Team: {{ team.name }} | {{ block.super }}
<a class="btn btn-danger" href="{% url 'teammember_remove' camp_slug=camp.slug pk=membership.id %}"><i class="fa fa-trash-o"></i> Remove</a> <a class="btn btn-danger" href="{% url 'teammember_remove' camp_slug=camp.slug pk=membership.id %}"><i class="fa fa-trash-o"></i> Remove</a>
<a class="btn btn-success" href="{% url 'teammember_approve' camp_slug=camp.slug pk=membership.id %}"><i class="fa fa-check"></i> Approve</a> <a class="btn btn-success" href="{% url 'teammember_approve' camp_slug=camp.slug pk=membership.id %}"><i class="fa fa-check"></i> Approve</a>
{% endif %} {% endif %}
</td>
</tr>
{% endfor %} {% endfor %}
</tbody>
</table>
{% else %}
<p>No members found!</p>
{% endif %}
{% endblock %} {% endblock %}