add membership status on team detail and list view
This commit is contained in:
parent
6bc0d57a52
commit
033ec1b8b5
|
@ -1,5 +1,6 @@
|
||||||
{% extends 'base.html' %}
|
{% extends 'base.html' %}
|
||||||
{% load commonmark %}
|
{% load commonmark %}
|
||||||
|
{% load teams_tags %}
|
||||||
|
|
||||||
{% block title %}
|
{% block title %}
|
||||||
Team: {{ team.name }} | {{ block.super }}
|
Team: {{ team.name }} | {{ block.super }}
|
||||||
|
@ -12,6 +13,10 @@ Team: {{ team.name }} | {{ block.super }}
|
||||||
{{ team.description|unsafecommonmark }}
|
{{ team.description|unsafecommonmark }}
|
||||||
<p>Currently {{ team.members.count }} people are members of this team{% if request.user in team.members.all %} (including you){% endif %}.</p>
|
<p>Currently {{ team.members.count }} people are members of this team{% if request.user in team.members.all %} (including you){% endif %}.</p>
|
||||||
|
|
||||||
|
{% if request.user in team.members.all %}
|
||||||
|
<p>Your team status: {% membershipstatus request.user team %}</p>
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
{% 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">Leave Team</a>
|
<a href="{% url 'team_leave' camp_slug=camp.slug slug=team.slug %}" class="btn btn-danger">Leave Team</a>
|
||||||
{% else %}
|
{% else %}
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
{% extends 'base.html' %}
|
{% extends 'base.html' %}
|
||||||
{% load commonmark %}
|
{% load commonmark %}
|
||||||
|
{% load teams_tags %}
|
||||||
|
|
||||||
{% block title %}
|
{% block title %}
|
||||||
Teams | {{ block.super }}
|
Teams | {{ block.super }}
|
||||||
|
@ -21,6 +22,7 @@ Teams | {{ block.super }}
|
||||||
<th>Description</th>
|
<th>Description</th>
|
||||||
<th>Responsible</th>
|
<th>Responsible</th>
|
||||||
<th>Members</th>
|
<th>Members</th>
|
||||||
|
<th>Member</th>
|
||||||
<th>Actions</th>
|
<th>Actions</th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
|
@ -44,6 +46,18 @@ Teams | {{ block.super }}
|
||||||
<span class="badge">{{ team.members.count }}</span>
|
<span class="badge">{{ team.members.count }}</span>
|
||||||
</td>
|
</td>
|
||||||
{% if request.user.is_authenticated %}
|
{% if request.user.is_authenticated %}
|
||||||
|
{% membershipstatus request.user team as membership_status %}
|
||||||
|
<td class="text-center">
|
||||||
|
{% if membership_status == 'Membership Pending' %}
|
||||||
|
<i class='fa fa-clock-o' title='Pending'></i>
|
||||||
|
{% else %}
|
||||||
|
{% if membership_status == 'Member' %}
|
||||||
|
<i class='fa fa-thumbs-o-up' title='Member'></i>
|
||||||
|
{% else %}
|
||||||
|
<i class='fa fa-times' title='Not a member'></i>
|
||||||
|
{% endif %}
|
||||||
|
{% endif %}
|
||||||
|
</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>
|
||||||
|
|
0
src/teams/templatetags/__init__.py
Normal file
0
src/teams/templatetags/__init__.py
Normal file
8
src/teams/templatetags/teams_tags.py
Normal file
8
src/teams/templatetags/teams_tags.py
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
from django import template
|
||||||
|
|
||||||
|
register = template.Library()
|
||||||
|
|
||||||
|
|
||||||
|
@register.simple_tag
|
||||||
|
def membershipstatus(user, team):
|
||||||
|
return team.memberstatus(user)
|
Loading…
Reference in a new issue