show team member count, only show join team button when team needs members

This commit is contained in:
Thomas Steen Rasmussen 2017-04-02 19:54:06 +02:00
parent 5b88085ac5
commit fe1708bb2c
2 changed files with 9 additions and 3 deletions

View file

@ -14,10 +14,10 @@ Team: {{ team.name }} | {{ block.super }}
<hr />
<h3>{{ team.area.name }} Area:</h3>
<p>This team is under the <b>{{ team.area.name }} area</b>. The following users are responsible for the <b>{{ team.area.name }} area</b>:</p>
<p>This team is under the <b>{{ team.area.name }} area</b>. The following people are responsible for the <b>{{ team.area.name }} area</b>:</p>
<ul>
{% for resp in team.area.responsible.all %}
<li>{{ resp.get_full_name|default:"Unnamed" }}</li>
<li><b>{{ resp.get_full_name|default:"Unnamed" }}</b></li>
{% endfor %}
</ul>
{% endblock %}

View file

@ -15,6 +15,7 @@ Teams | {{ block.super }}
<th>Description</th>
<th>Area</th>
<th>Responsible</th>
<th>Members</th>
{% if request.user.is_authenticated %}
<th>Membership</th>
<th>Action</th>
@ -26,7 +27,7 @@ Teams | {{ block.super }}
<tr>
<td>
<a href="{% url 'team_detail' camp_slug=camp.slug slug=team.slug %}">
{{ team.name }}
{{ team.name }} Team
</a>
</td>
<td>
@ -40,6 +41,9 @@ Teams | {{ block.super }}
{{ resp.get_full_name|default:"Unnamed" }}{% if not forloop.last %},{% endif %}<br>
{% endfor %}
</td>
<td class="text-center">
<span class="badge">{{ team.members.count }}</span>
</td>
{% if request.user.is_authenticated %}
<td>
{% if request.user in team.members.all %}
@ -52,8 +56,10 @@ Teams | {{ block.super }}
{% 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>
{% else %}
{% 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</button>
{% endif %}
{% endif %}
</td>
{% endif %}
</tr>