Private
Public Access
1
0

Team create, delete, leave, create invite

This commit is contained in:
Sander Roosendaal
2017-02-09 17:50:32 +01:00
parent f459cea2bd
commit 40e18fee21
10 changed files with 473 additions and 60 deletions

View File

@@ -0,0 +1,61 @@
{% extends "base.html" %}
{% block title %}Team {% endblock %}
{% block content %}
<div class="grid_12 alpha">
<h1>{{ team.name }}</h1>
<p>{{ team.notes }}</p>
<div class="grid_2 suffix_10 alpha">
<a class="button red small" href="/rowers/team/{{ team.id }}/leaveconfirm">Leave this team</a>
</div>
<div class="grid_6 alpha">
<p>
<h2>Members</h2>
<table width="100%" class="listtable">
<thead>
<tr>
<th>Name</th>
</tr>
</thead>
<tbody>
{% for member in members %}
<tr>
<td> {{ member.user.first_name }} {{ member.user.last_name }}</td>
</tr>
{% endfor %}
</tbody>
</table>
</p>
</div>
<div class="grid_6 omega">
{% if team.manager == user %}
<p>Use the form to add a new user. You can either select a user from the slist, or you can type his email address, which also works for users who have not registered to the site yet.</p>
{% if inviteform.errors %}
<p style="color: red;">
Please correct the error{{ inviteform.errors|pluralize }} below.
</p>
{% endif %}
<form enctype="multipart/form-data" action="{{ formloc }}" method="post">
<table>
{{ inviteform.as_table }}
</table>
{% csrf_token %}
<div id="formbutton" class="grid_1 prefix_4 suffix_1">
<input class="button green" type="submit" value="Submit">
</div>
</form>
{% else %}
<p>
&nbsp;
</p>
{% endif %}
</div>
</div>
{% endblock %}

View File

@@ -0,0 +1,28 @@
{% extends "base.html" %}
{% load staticfiles %}
{% block title %}New Team{% endblock %}
{% block content %}
<form enctype="multipart/form-data" action="{{ formloc }}" method="post">
<div id="left" class="grid_6 alpha">
<h1>Create a new Team</h1>
{% if form.errors %}
<p style="color: red;">
Please correct the error{{ form.errors|pluralize }} below.
</p>
{% endif %}
<table>
{{ form.as_table }}
</table>
{% csrf_token %}
<div id="formbutton" class="grid_1 prefix_4 suffix_1">
<input class="button green" type="submit" value="Submit">
</div>
</div>
</form>
{% endblock %}

View File

@@ -0,0 +1,43 @@
{% extends "base.html" %}
{% load staticfiles %}
{% load rowerfilters %}
{% block title %}Leave Team {% endblock %}
{% block content %}
<div id="workouts" class="grid_6 alpha">
{% if form.errors %}
<p style="color: red;">
Please correct the error{{ form.errors|pluralize }} below.
</p>
{% endif %}
<h1>Confirm Deleting the team {{ team.name }}</h1>
<p>This will remove the team. Your team members and their workouts
will not be deleted.
</p>
<div class="grid_2 alpha">
<p>
<a class="button green small" href="/rowers/team/{{ team.id }}">Cancel</a>
</div>
<div class="grid_2">
<p>
<a class="button red small" href="/rowers/team/{{ team.id }}/delete">Delete</a>
</p>
</div>
</div>
<div id="images" class="grid_6 omega">
<p>
&nbsp;
</p>
</div>
{% endblock %}

View File

@@ -0,0 +1,45 @@
{% extends "base.html" %}
{% load staticfiles %}
{% load rowerfilters %}
{% block title %}Leave Team {% endblock %}
{% block content %}
<div id="workouts" class="grid_6 alpha">
{% if form.errors %}
<p style="color: red;">
Please correct the error{{ form.errors|pluralize }} below.
</p>
{% endif %}
<h1>Confirm Leaving the team {{ team.name }}</h1>
<p>This will remove you and all your workouts from the team. If this
is a closed team, you can only return when the team manager
reinvites you.
If this is an open team, you can return by applying for team membership.
</p>
<div class="grid_2 alpha">
<p>
<a class="button green small" href="/rowers/team/{{ team.id }}">Cancel</a>
</div>
<div class="grid_2">
<p>
<a class="button red small" href="/rowers/team/{{ team.id }}/leave">Leave</a>
</p>
</div>
</div>
<div id="images" class="grid_6 omega">
<p>
&nbsp;
</p>
</div>
{% endblock %}

View File

@@ -6,10 +6,33 @@
<div class="grid_12 alpha">
<div class="grid_6 alpha">
<p>
<h2>Teams</h2>
Future teams page
<h2>My Teams</h2>
{% if teams %}
<table width="70%" class="listtable">
<thead>
<tr>
<th>Name</th>
<th>&nbsp;</th>
</tr>
</thead>
<tbody>
{% for team in teams %}
<tr>
<td>
<a href="/rowers/team/{{ team.id }}/">{{ team.name }}</a>
</td>
<td>
<div class="grid_1">
<a class="button small red" href="/rowers/team/{{ team.id }}/leaveconfirm">Leave</a>
</div>
</td>
</tr>
{% endfor %}
</tbody>
</table>
{% else %}
<p>You are not a member of any team.</p>
{% endif %}
</p>
@@ -21,7 +44,40 @@
</div>
</div>
{% if user.rower.rowerplan == 'coach' %}
<div class="grid_12 alpha">
<div class="grid_6 alpha">
<h2>Teams I manage</h2>
{% if myteams %}
<table width="70%" class="listtable">
<thead>
<tr>
<th>Name</th>
<th>&nbsp;</th>
</tr>
</thead>
<tbody>
{% for team in myteams %}
<tr>
<td>
<a href="/rowers/team/{{ team.id }}/">{{ team.name }}</a>
</td>
<td>
<div class="grid_1">
<a class="button small red" href="/rowers/team/{{ team.id }}/deleteconfirm">Delete</a>
</div>
</td>
</tr>
{% endfor %}
</tbody>
</table>
{% endif %}
<div class="grid_2 suffix_2 prefix_2 alpha">
<a class="button green" href="/rowers/team/create">New Team</a>
</div>
</div>
</div>
{% endif %}
{% endblock %}