Private
Public Access
1
0

lots of ui changes

This commit is contained in:
Sander Roosendaal
2021-03-08 12:02:11 +01:00
parent 35d97797c7
commit 760ac8702d
9 changed files with 148 additions and 601 deletions

View File

@@ -5,29 +5,10 @@
{% block title %}New Planned Session{% endblock %} {% block title %}New Planned Session{% endblock %}
{% block main %} {% block main %}
<h1>Create Sessions for {{ rower.user.first_name }} {{ rower.user.last_name }}</h1> <h1>New Session</h1>
<ul class="main-content"> <ul class="main-content">
<li class="grid_2"> <li class="grid_4">
<p>
<form enctype="multipart/form-data" method="get">
<table>
{{ dateform.as_table }}
</table>
<input type="Submit" value="Set Date Range">
</form>
</p>
</li>
<li class="grid_2">
<p><a href="/rowers/sessions/?startdate={{ timeperiod|previousperiodstart }}&enddate={{ timeperiod|previousperiodend}}">Back by
{{ timeperiod|timedeltadays }} days</a>
</p>
<p><a href="/rowers/sessions/?startdate={{ timeperiod|nextperiodstart }}&enddate={{ timeperiod|nextperiodend}}">Forward by
{{ timeperiod|timedeltadays }} days</a>
</p>
</li>
<li class="grid_2">
<h1>New Session</h1>
<form enctype="multipart/form-data" action="" <form enctype="multipart/form-data" action=""
method="post"> method="post">
{% if form.errors %} {% if form.errors %}
@@ -40,120 +21,12 @@
{{ form.as_table }} {{ form.as_table }}
</table> </table>
{% csrf_token %} {% csrf_token %}
<input class="button" type="submit" value="Save"> <p><input class="button" type="submit" value="Save" name="_save"></p>
<p><input class="button" type="submit" value="Save and Keep Editing" name="_continue"></p>
<p><input class="button" type="submit" value="Save and Create New Session" name="_addanother"></p>
</form> </form>
<div class="padded" id="id_guidance"> <div class="padded" id="id_guidance">
</li> </li>
<li class="grid_2">
<h1>Plan</h1>
<p>
Click on session name to view
</p>
<table class="listtable shortpadded" width="80%">
<thead>
<tr>
<th>After</th>
<th>Before</th>
<th>Name</th>
<th>Value</th>
<th>&nbsp;</th>
<th>Edit</th>
<th>Clone</th>
<th>Delete</th>
<th>Library</th>
</tr>
</thead>
<tbody>
{% for ps in plannedsessions %}
<tr>
<td> {{ ps.startdate|date:"Y-m-d" }} </td>
<td> {{ ps.enddate|date:"Y-m-d" }} </td>
<td>
{% if ps.name != '' %}
<a class="small"
href="/rowers/sessions/{{ ps.id }}/">{{ ps.name }}</a>
{% else %}
<a class="small"
href="/rowers/sessions/{{ ps.id }}/">Unnamed Session</a>
{% endif %}
</td>
<td> {{ ps.sessionvalue }} </td>
<td> {{ ps.sessionunit }} </td>
<td>
<a class="small" href="/rowers/sessions/{{ ps.id }}/edit/user/{{ rower.user.id }}/?when={{ timeperiod }}/?when={{ timeperiod }}">
<i class="fas fa-pencil-alt fa-fw"></i></a>
</td>
<td>
<a class="small" href="/rowers/sessions/{{ ps.id }}/clone/user/{{ rower.user.id }}/?when={{ timeperiod }}/?when={{ timeperiod }}">
<i class="fas fa-clone fa-fw"></i></a>
</td>
<td>
<a class="small" href="/rowers/sessions/{{ ps.id }}/deleteconfirm/"><i class="fas fa-trash-alt fa-fw"></i></a>
</td>
<td>
<a class="small" href="/rowers/sessions/{{ ps.id }}/maketemplate/"><i class="fas fa-books fa-fw"></i></a>
</td>
</tr>
{% endfor %}
</tbody>
</table>
</li>
<li class="grid_2">
<h1>Session Library</h1>
{% if alltags %}
<p>
Click on a tag to filter:
{% for tag in alltags %}
<a href="/rowers/sessions/create/?when={{ timeperiod }}&tag={{ tag }}">{{ tag }}</a>
{% endfor %}
</p>
<p>
<a href="/rowers/sessions/create/?when={{ timeperiod }}">Clear tags</a>
</p>
{% endif %}
<table class="listtable shortpadded" width="80%">
<thead>
<tr>
<th>Name</th>
<th>Value</th>
<th>Copy to Calendar</th>
<th>Edit</th>
<th>Delete</th>
</tr>
</thead>
<tbody>
{% for ps in sessiontemplates %}
<tr>
<td>
{% if ps.name != '' %}
{{ ps.name }}
{% else %}
Unnamed Session
{% endif %}
</td>
<td> {{ ps.sessionvalue }} {{ ps.sessionunit }} </td>
<td>
<a class="small"
href="/rowers/sessions/{{ ps.id }}/clone/user/{{ rower.user.id }}/?when={{ timeperiod }}">
<i class="fas fa-clone fa-fw"></i>
</a>
</td>
{% if ps.manager == request.user %}
<td>
<a class="small" href="/rowers/sessions/{{ ps.id }}/templateedit/"><i class="fas fa-pencil-alt fa-fw"></i></a>
</td>
<td>
<a class="small" href="/rowers/sessions/{{ ps.id }}/deleteconfirm/?next={{ request.path|urlencode }}"><i class="fas fa-trash-alt fa-fw"></i></a>
</td>
{% else %}
<td></td><td></td>
{% endif %}
</tr>
{% endfor %}
</tbody>
</table>
</li>
</ul> </ul>
{% endblock %} {% endblock %}

View File

@@ -10,25 +10,7 @@
<ul class="main-content"> <ul class="main-content">
<li class="grid_2"> <li class="grid_4">
<p>
<form enctype="multipart/form-data" method="get">
<table>
{{ dateform.as_table }}
</table>
<input type="Submit" value="Set Date Range">
</form>
</p>
</li>
<li class="grid_2">
<p><a href="/rowers/sessions/?startdate={{ timeperiod|previousperiodstart }}&enddate={{ timeperiod|previousperiodend}}">Back by
{{ timeperiod|timedeltadays }} days</a>
</p>
<p><a href="/rowers/sessions/?startdate={{ timeperiod|nextperiodstart }}&enddate={{ timeperiod|nextperiodend}}">Forward by
{{ timeperiod|timedeltadays }} days</a>
</p>
</li>
<li class="grid_2">
<h2>{{ thesession.name }}</h2> <h2>{{ thesession.name }}</h2>
{% if user.is_authenticated and user|is_manager %} {% if user.is_authenticated and user|is_manager %}
<p> <p>
@@ -52,104 +34,16 @@
<div id="id_guidance"> <div id="id_guidance">
</div> </div>
<p><input class="button" type="submit" value="Save" name="_save"></p>
<p><input class="button" type="submit" value="Save and Keep Editing" name="_continue"></p>
<p> <p>
<a href="/rowers/sessions/{{ thesession.id }}/deleteconfirm"><i class="fas fa-trash-alt fa-fw"></i> Delete</a> <a href="/rowers/sessions/{{ thesession.id }}/deleteconfirm"><i class="fas fa-trash-alt fa-fw"></i> Delete</a>
<a href="/rowers/sessions/{{ thesession.id }}/clone/?when={{ timeperiod }}"><i class="fas fa-clone fa-fw"></i> Clone</a> <a href="/rowers/sessions/{{ thesession.id }}/clone/?when={{ timeperiod }}"><i class="fas fa-clone fa-fw"></i> Clone</a>
</p> </p>
<input class="button"
action="/rowers/sessions/{{ thesession.id }}/edit/user/{{ rower.user.id }}/" type="submit" value="Save">
</form> </form>
</li> </li>
<li class="grid_2">
<h2>Plan</h2>
<p>
Click on session name to view
</p>
<table class="listtable shortpadded" width="80%">
<thead>
<tr>
<th>After</th>
<th>Before</th>
<th>Name</th>
<th>Value</th>
<th>&nbsp;</th>
<th>Edit</th>
<th>Clone</th>
<th>Delete</th>
</tr>
</thead>
<tbody>
{% for ps in plannedsessions %}
<tr>
<td> {{ ps.startdate|date:"Y-m-d" }} </td>
<td> {{ ps.enddate|date:"Y-m-d" }} </td>
<td>
{% if ps.name != '' %}
<a class="small"
href="/rowers/sessions/{{ ps.id }}">{{ ps.name }}</a>
{% else %}
<a class="small"
href="/rowers/sessions/{{ ps.id }}">Unnamed Session</a>
{% endif %}
</td>
<td> {{ ps.sessionvalue }} </td>
<td> {{ ps.sessionunit }} </td>
<td>
<a class="small" href="/rowers/sessions/{{ ps.id }}/edit/user/{{ rower.user.id }}/?when={{ timeperiod }}"><i class="fas fa-pencil-alt fa-fw"></i></a>
</td>
<td>
<a class="small"
href="/rowers/sessions/{{ ps.id }}/clone/user/{{ rower.user.id }}/?when={{ timeperiod }}"><i class="fas fa-clone fa-fw"></i></a>
</td>
<td>
<a class="small" href="/rowers/sessions/{{ ps.id }}/deleteconfirm"><i class="fas fa-trash-alt fa-fw"></i></a>
</td>
</tr>
{% endfor %}
</tbody>
</table>
</li>
<li class="grid_2">
<h1>Session Library</h1>
<p>
Click on session name to clone to current period
</p>
<table class="listtable shortpadded" width="80%">
<thead>
<tr>
<th>Name</th>
<th>Value</th>
<th>&nbsp;</th>
<th>Edit</th>
<th>Delete</th>
</tr>
</thead>
<tbody>
{% for ps in sessiontemplates %}
<tr>
<td>
{% if ps.name != '' %}
<a class="small"
href="/rowers/sessions/{{ ps.id }}/clone/user/{{ rower.user.id }}/?when={{ timeperiod }}">{{ ps.name }}</a>
{% else %}
<a class="small"
href="/rowers/sessions/{{ ps.id }}/clone/user/{{ rower.user.id }}/?when={{ timeperiod }}">Unnamed Session</a>
{% endif %}
</td>
<td> {{ ps.sessionvalue }} </td>
<td> {{ ps.sessionunit }} </td>
<td>
<a class="small" href="/rowers/sessions/{{ ps.id }}/templateedit/"><i class="fas fa-pencil-alt fa-fw"></i></a>
</td>
<td>
<a class="small" href="/rowers/sessions/{{ ps.id }}/deleteconfirm/"><i class="fas fa-trash-alt fa-fw"></i> Delete</a>
</td>
</tr>
{% endfor %}
</tbody>
</table>
</li>
</ul> </ul>
{% endblock %} {% endblock %}

View File

@@ -9,13 +9,14 @@
<h1>Planned Sessions for {{ rower.user.first_name }} {{ rower.user.last_name }}</h1> <h1>Planned Sessions for {{ rower.user.first_name }} {{ rower.user.last_name }}</h1>
<p> <p>
<a href="/rowers/sessions/create/?when={{ timeperiod }}"> <i class="far fa-calendar-plus fa-fw"></i>&nbsp;Add Session <a href="/rowers/sessions/create/?when={{ timeperiod }}"> <i class="fas fa-calendar-plus fa-fw"></i>&nbsp;Add Session
</a> </a>
{% if request.user|user_teams %} {% if request.user|user_teams %}
<a href="/rowers/sessions/teamcreate/?when={{ timeperiod }}"> <a href="/rowers/sessions/teamcreate/?when={{ timeperiod }}">
<i class="fas fa-whistle fa-fw"></i>&nbsp;Add Group Session <i class="fas fa-whistle fa-fw"></i>&nbsp;Add Group Session
</a> </a>
{% endif %} {% endif %}
<a href="/rowers/sessions/library/"><i class="fas fa-books fa-fw"></i>&nbsp;Add Session from Library</a>
</p> </p>
<ul class="main-content"> <ul class="main-content">
@@ -40,8 +41,7 @@
<li class="grid_4"> <li class="grid_4">
{% if plannedsessions %} {% if plannedsessions %}
<p> <p>
Click on session name to view, edit to change the session and on the Click on the session name to view, on the circle to attach workouts to the session.
traffic light symbol to add workouts to the session
</p> </p>
<table width="90%" class="listtable shortpadded"> <table width="90%" class="listtable shortpadded">
<thead> <thead>
@@ -53,6 +53,8 @@
<th align="left">Type</th> <th align="left">Type</th>
<th align="left">Mode</th> <th align="left">Mode</th>
<th align="left">Edit</th> <th align="left">Edit</th>
<th align="left">Clone</th>
<th align="left">Delete</th>
<th align="left">Planned</th> <th align="left">Planned</th>
<th align="left">Actual</th> <th align="left">Actual</th>
<th align="left">&nbsp;</th> <th align="left">&nbsp;</th>
@@ -106,6 +108,22 @@
{% else %} {% else %}
&nbsp; &nbsp;
{% endif %} {% endif %}
</td>
<td>
{% if ps.manager == request.user %}
<a class="small"
href="/rowers/sessions/{{ ps.id }}/clone/user/{{ rower.user.id }}/?when={{ timeperiod }}"><i class="fas fa-clone fa-fw"></i></a>
{% else %}
&nbsp;
{% endif %}
</td>
<td>
{% if ps.manager == request.user %}
<a class="small"
href="/rowers/sessions/{{ ps.id }}/deleteconfirm"><i class="fas fa-trash-alt fa-fw"></i></a>
{% else %}
&nbsp;
{% endif %}
</td> </td>
<td> {{ ps.sessionvalue }} </td> <td> {{ ps.sessionvalue }} </td>
<td> {{ actualvalue|lookup:ps.id }}</td> <td> {{ actualvalue|lookup:ps.id }}</td>

View File

@@ -5,163 +5,37 @@
{% block title %}New Planned Session{% endblock %} {% block title %}New Planned Session{% endblock %}
{% block main %} {% block main %}
<h1>Create Team Session</h1>
<h1>New Team Session</h1>
<ul class="main-content"> <ul class="main-content">
<li class="grid_2">
<p>
<form enctype="multipart/form-data" method="get">
<table>
{{ dateform.as_table }}
</table>
<input type="Submit" value="Set Date Range">
</form>
</p>
</li>
<li class="grid_2">
<p><a href="/rowers/sessions/teamcreate/?startdate={{ timeperiod|previousperiodstart }}&enddate={{ timeperiod|previousperiodend}}">Back by
{{ timeperiod|timedeltadays }} days</a>
</p>
<p><a href="/rowers/sessions/teamcreate/?startdate={{ timeperiod|nextperiodstart }}&enddate={{ timeperiod|nextperiodend}}">Forward by
{{ timeperiod|timedeltadays }} days</a>
</p>
</li>
</ul>
<form enctype="multipart/form-data" action="" method="post"> <li class="grid_4">
{% if form.errors %} <form enctype="multipart/form-data" action="" method="post">
<p style="color: red;"> {% if form.errors %}
Please correct the error{{ form.errors|pluralize }} below. <p style="color: red;">
</p> Please correct the error{{ form.errors|pluralize }} below.
{% endif %} </p>
{% endif %}
<ul class="main-content">
<li class="grid_2">
{% csrf_token %} {% csrf_token %}
<h1>New Team Session</h1>
<table> <table>
{{ teamform.as_table }} {{ teamform.as_table }}
</table> </table>
<table> <table>
{{ form.as_table }} {{ form.as_table }}
</table> </table>
<input class="button green" type="submit" value="Save"> <p><input class="button" type="submit" value="Save" name="_save"></p>
<p><input class="button" type="submit" value="Save and Keep Editing" name="_continue"></p>
<p><input class="button" type="submit" value="Save and Create New Session" name="_addanother"></p>
<div id="id_guidance" class="padded"> <div id="id_guidance" class="padded">
</div> </div>
</form>
</li> </li>
{% if plannedsessions %}
<li class="grid_2">
<h1>Team Plan Sessions</h1>
<p>
<table class="listtable shortpadded" width="80%">
<thead>
<tr>
<th>After</th>
<th>Before</th>
<th>Name</th>
<th>Value</th>
<th>&nbsp;</th>
<th>Edit</th>
<th>Clone</th>
<th>Delete</th>
<th>To Library</th>
</tr>
</thead>
<tbody>
{% for ps in plannedsessions %}
<tr>
<td> {{ ps.startdate|date:"Y-m-d" }} </td>
<td> {{ ps.enddate|date:"Y-m-d" }} </td>
<td>
{% if ps.name != '' %}
<a class="small"
href="/rowers/sessions/{{ ps.id }}/">{{ ps.name }}</a>
{% else %}
<a class="small"
href="/rowers/sessions/{{ ps.id }}/">Unnamed Session</a>
{% endif %}
</td>
<td> {{ ps.sessionvalue }} </td>
<td> {{ ps.sessionunit }} </td>
<td>
<a class="small" href="/rowers/sessions/{{ ps.id }}/edit/"><i class="fas fa-pencil-alt fa-fw"></i></a>
</td>
<td>
<a class="small" href="/rowers/sessions/{{ ps.id }}/clone/"><i class="fas fa-clone fa-fw"></i></a>
</td>
<td>
<a class="small" href="/rowers/sessions/{{ ps.id }}/deleteconfirm/"><i class="fas fa-trash-alt fa-fw"></i></a>
</td>
<td>
<a class="small" href="/rowers/sessions/{{ ps.id }}/maketemplate/"><i class="fas fa-books fa-fw"></i></a>
</td>
</tr>
{% endfor %}
</tbody>
</table>
</p>
</li>
{% endif %}
<li class="grid_2">
<h1>Session Library</h1>
{% if alltags %}
<p>
Click on a tag to filter:
{% for tag in alltags %}
<a href="/rowers/sessions/create/?when={{ timeperiod }}&tag={{ tag }}">{{ tag }}</a>
{% endfor %}
</p>
<p>
<a href="/rowers/sessions/create/?when={{ timeperiod }}">Clear tags</a>
</p>
{% endif %}
<table class="listtable shortpadded" width="80%">
<thead>
<tr>
<th>Name</th>
<th>Value</th>
<th>Copy to Calendar</th>
<th>Edit</th>
<th>Delete</th>
</tr>
</thead>
<tbody>
{% for ps in sessiontemplates %}
<tr>
<td>
{% if ps.name != '' %}
{{ ps.name }}
{% else %}
Unnamed Session
{% endif %}
</td>
<td> {{ ps.sessionvalue }} {{ ps.sessionunit }} </td>
<td>
<a class="small"
href="/rowers/sessions/{{ ps.id }}/clone/team/">
<i class="fas fa-clone fa-fw"></i>
</a>
</td>
{% if ps.manager == request.user %}
<td>
<a class="small" href="/rowers/sessions/{{ ps.id }}/templateedit/"><i class="fas fa-pencil-alt fa-fw"></i></a>
</td>
<td>
<a class="small" href="/rowers/sessions/{{ ps.id }}/deleteconfirm/?next={{ request.path|urlencode }}"><i class="fas fa-trash-alt fa-fw"></i></a>
</td>
{% else %}
<td></td><td></td>
{% endif %}
</tr>
{% endfor %}
</tbody>
</table>
</li>
</ul> </ul>
</form>
{% endblock %} {% endblock %}

View File

@@ -5,129 +5,37 @@
{% block title %}New Planned Session{% endblock %} {% block title %}New Planned Session{% endblock %}
{% block main %} {% block main %}
<h1>Edit Team Session</h1> <h1>Edit Session {{ plannedsession.name }}</h1>
<ul class="main-content"> <ul class="main-content">
<li class="grid_2"> <li class="grid_4">
<p>
<form enctype="multipart/form-data" method="get">
<table>
{{ dateform.as_table }}
</table>
<input type="Submit" value="Set Date Range">
</form>
</p>
</li>
<li class="grid_2">
<p><a href="/rowers/sessions/coach/?startdate={{ timeperiod|previousperiodstart }}&enddate={{ timeperiod|previousperiodend}}">Back by
{{ timeperiod|timedeltadays }} days</a>
</p>
<p><a href="/rowers/sessions/coach/?startdate={{ timeperiod|nextperiodstart }}&enddate={{ timeperiod|nextperiodend}}">Forward by
{{ timeperiod|timedeltadays }} days</a>
</p>
</li>
</ul>
<form enctype="multipart/form-data" action="" method="post">
{% if form.errors %}
<p style="color: red;">
Please correct the error{{ form.errors|pluralize }} below.
</p>
{% endif %}
{% csrf_token %}
<ul class="main-content">
<li class="grid_2">
<h1>Select Team</h1>
<p> <p>
Selecting a team assigns this session to all members of the team.
Unselecting a team does not remove rowers
who are already assigned to this session. Use the Rowers selection for that.
</p><p>
<table> <table>
{{ teamform.as_table }} {{ teamform.as_table }}
</table></p> </table>
</li>
<li class="grid_2">
<h1>Select Rowers</h1>
<p>
<table> <table>
{{ rowersform.as_table }} {{ rowersform.as_table }}
</table> </table>
</p> </p>
</li> </li>
<li class="grid_2"> <li class="grid_4">
<h1>Session {{ plannedsession.name }}</h1>
<table> <table>
{{ form.as_table }} {{ form.as_table }}
</table> </table>
<p><input class="button" type="submit" value="Save" name="_save"></p>
<p><input class="button" type="submit" value="Save and Keep Editing" name="_continue"></p>
<p> <p>
<a href="/rowers/sessions/{{ plannedsession.id }}/deleteconfirm"><i class="fas fa-trash-alt fa-fw"></i> Delete</a> <a href="/rowers/sessions/{{ plannedsession.id }}/deleteconfirm"><i class="fas fa-trash-alt fa-fw"></i> Delete</a>
</p> </p>
<p> <p>
<a href="/rowers/sessions/{{ plannedsession.id }}/clone"><i class="fas fa-clone fa-fw"></i> Clone</a> <a href="/rowers/sessions/{{ plannedsession.id }}/clone"><i class="fas fa-clone fa-fw"></i> Clone</a>
</p> </p>
<p>
<input type="submit" value="Save">
</p>
<div id="id_guidance" class="padded"> <div id="id_guidance" class="padded">
</div> </div>
</li> </li>
<li class="grid_2">
{% if plannedsessions %}
<h1>Team Plan Sessions</h1>
<p>
<table class="listtable shortpadded" width="80%">
<thead>
<tr>
<th>After</th>
<th>Before</th>
<th>Name</th>
<th>Value</th>
<th>&nbsp;</th>
<th>Edit</th>
<th>Clone</th>
<th>Delete</th>
<th>To Library</th>
</tr>
</thead>
<tbody>
{% for ps in plannedsessions %}
<tr>
<td> {{ ps.startdate|date:"Y-m-d" }} </td>
<td> {{ ps.enddate|date:"Y-m-d" }} </td>
<td>
{% if ps.name != '' %}
<a class="small"
href="/rowers/sessions/{{ ps.id }}">{{ ps.name }}</a>
{% else %}
<a class="small"
href="/rowers/sessions/{{ ps.id }}">Unnamed Session</a>
{% endif %}
</td>
<td> {{ ps.sessionvalue }} </td>
<td> {{ ps.sessionunit }} </td>
<td>
<a class="small" href="/rowers/sessions/{{ ps.id }}/edit"><i class="fas fa-pencil-alt fa-fw"></i></a>
</td>
<td>
<a class="small" href="/rowers/sessions/{{ ps.id }}/clone"><i class="fas fa-clone fa-fw"></i></a>
</td>
<td>
<a class="small" href="/rowers/sessions/{{ ps.id }}/deleteconfirm"><i class="fas fa-trash-alt fa-fw"></i></a>
</td>
<td>
<a class="small" href="/rowers/sessions/{{ ps.id }}/maketemplate/"><i class="fas fa-books fa-fw"></i></a>
</td>
</tr>
{% endfor %}
</tbody>
</table>
</p>
{% endif %}
</li>
</ul> </ul>
</form> </form>
{% endblock %} {% endblock %}

View File

@@ -5,13 +5,12 @@
{% block title %}Create Library Session{% endblock %} {% block title %}Create Library Session{% endblock %}
{% block main %} {% block main %}
<h1>Edit Session Template</h1> <h1>Create New Library Session</h1>
<ul class="main-content"> <ul class="main-content">
<li class="grid_2"> <li class="grid_2">
<h2>Create New Library Session</h2>
<form enctype="multipart/form-data" action="{{ formloc }}" method="post"> <form enctype="multipart/form-data" action="{{ formloc }}" method="post">
{% if form.errors %} {% if form.errors %}
<p style="color: red;"> <p style="color: red;">
@@ -27,51 +26,12 @@
<div id="id_guidance"> <div id="id_guidance">
</div> </div>
<input class="button" <p><input class="button" type="submit" value="Save" name="_save"></p>
type="submit" value="Save"> <p><input class="button" type="submit" value="Save and Keep Editing" name="_continue"></p>
<p><input class="button" type="submit" value="Save and Create New Session" name="_addanother"></p>
</form> </form>
</li> </li>
<li class="grid_2">
<h1>Library</h1>
<p>
Click on session name to clone to current period
</p>
<table class="listtable shortpadded" width="80%">
<thead>
<tr>
<th>Name</th>
<th>Value</th>
<th>&nbsp;</th>
<th>Edit</th>
<th>Delete</th>
</tr>
</thead>
<tbody>
{% for ps in sessiontemplates %}
<tr>
<td>
{% if ps.name != '' %}
<a class="small"
href="/rowers/sessions/{{ ps.id }}/clone/user/{{ rower.user.id }}/?when={{ timeperiod }}">{{ ps.name }}</a>
{% else %}
<a class="small"
href="/rowers/sessions/{{ ps.id }}/clone/user/{{ rower.user.id }}/?when={{ timeperiod }}">Unnamed Session</a>
{% endif %}
</td>
<td> {{ ps.sessionvalue }} </td>
<td> {{ ps.sessionunit }} </td>
<td>
<a class="small" href="/rowers/sessions/{{ ps.id }}/templateedit/"><i class="fas fa-pencil-alt fa-fw"></i> </a>
</td>
<td>
<a class="small" href="/rowers/sessions/{{ ps.id }}/deleteconfirm/"><i class="fas fa-trash-alt fa-fw"></i> </a>
</td>
</tr>
{% endfor %}
</tbody>
</table>
</li>
</ul> </ul>
{% endblock %} {% endblock %}

View File

@@ -5,13 +5,12 @@
{% block title %}Update Library Session{% endblock %} {% block title %}Update Library Session{% endblock %}
{% block main %} {% block main %}
<h1>Edit Session Template</h1> <h1>Edit Library Session: {{ thesession.name }}</h1>
<ul class="main-content"> <ul class="main-content">
<li class="grid_2"> <li class="grid_2">
<h2>{{ thesession.name }}</h2>
<form enctype="multipart/form-data" action="{{ formloc }}" method="post"> <form enctype="multipart/form-data" action="{{ formloc }}" method="post">
{% if form.errors %} {% if form.errors %}
<p style="color: red;"> <p style="color: red;">
@@ -27,49 +26,15 @@
<div id="id_guidance"> <div id="id_guidance">
</div> </div>
<p> <p><input class="button" type="submit" value="Save" name="_save"></p>
<a href="/rowers/sessions/{{ thesession.id }}/deleteconfirm"><i class="fas fa-trash-alt fa-fw"></i> Delete</a> <p><input class="button" type="submit" value="Save and Keep Editing" name="_continue"></p>
</p> <p>
<input class="button" <a href="/rowers/sessions/{{ thesession.id }}/deleteconfirm"><i class="fas fa-trash-alt fa-fw"></i> Delete</a>
action="/rowers/sessions/{{ thesession.id }}/templateedit/" type="submit" value="Save"> </p>
</form> </form>
</li> </li>
<li class="grid_2">
<h1>Library</h1>
<table class="listtable shortpadded" width="80%">
<thead>
<tr>
<th>Name</th>
<th>Value</th>
<th>&nbsp;</th>
<th>Edit</th>
<th>Delete</th>
</tr>
</thead>
<tbody>
{% for ps in sessiontemplates %}
<tr>
<td>
{% if ps.name != '' %}
{{ ps.name }}
{% else %}
Unnamed Session
{% endif %}
</td>
<td> {{ ps.sessionvalue }} </td>
<td> {{ ps.sessionunit }} </td>
<td>
<a class="small" href="/rowers/sessions/{{ ps.id }}/templateedit/"><i class="fas fa-pencil-alt fa-fw"></i> </a>
</td>
<td>
<a class="small" href="/rowers/sessions/{{ ps.id }}/deleteconfirm/"><i class="fas fa-trash-alt fa-fw"></i> </a>
</td>
</tr>
{% endfor %}
</tbody>
</table>
</li>
</ul> </ul>
{% endblock %} {% endblock %}

View File

@@ -838,8 +838,10 @@ urlpatterns = [
re_path(r'^sessions/multicreate/user/(?P<userid>\d+)/$', re_path(r'^sessions/multicreate/user/(?P<userid>\d+)/$',
views.plannedsession_multicreate_view, views.plannedsession_multicreate_view,
name='plannedsession_multicreate_view'), name='plannedsession_multicreate_view'),
re_path(r'^sessions/(?P<id>\d+)/edit/$',views.plannedsession_edit_view), re_path(r'^sessions/(?P<id>\d+)/edit/$',views.plannedsession_edit_view,
re_path(r'^sessions/(?P<id>\d+)/templateedit/',views.plannedsession_templateedit_view), name='plannedsession_edit_view'),
re_path(r'^sessions/(?P<id>\d+)/templateedit/',views.plannedsession_templateedit_view,
name='plannedsession_templateedit_view'),
re_path(r'^sessions/(?P<id>\d+)/maketemplate/$',views.plannedsession_totemplate_view), re_path(r'^sessions/(?P<id>\d+)/maketemplate/$',views.plannedsession_totemplate_view),
re_path(r'^sessions/(?P<id>\d+)/compare/$', re_path(r'^sessions/(?P<id>\d+)/compare/$',
views.plannedsession_compare_view, views.plannedsession_compare_view,

View File

@@ -531,9 +531,18 @@ def plannedsession_create_view(request,
request.session['fenddate'] = str(arrow.get(ps.enddate)) request.session['fenddate'] = str(arrow.get(ps.enddate))
request.session['fprefdate'] = str(arrow.get(ps.preferreddate)) request.session['fprefdate'] = str(arrow.get(ps.preferreddate))
url = reverse(plannedsessions_view,kwargs={ url = reverse(plannedsessions_view,kwargs={
'userid':userid, 'userid':userid,
}) })
if '_continue' in request.POST:
url = reverse('plannedsession_edit_view',kwargs={
'id':ps.id,
})
elif '_addanother' in request.POST:
url = reverse('plannedsession_create_view',kwargs={'userid':userid})
return HttpResponseRedirect(url) return HttpResponseRedirect(url)
else: else:
@@ -639,11 +648,23 @@ def plannedsession_create_view(request,
'enddate':enddate, 'enddate':enddate,
}) })
breadcrumbs = [
{
'url': reverse(plannedsessions_view),
'name': 'Planned Sessions'
},
{
'url': reverse(plannedsession_create_view),
'name': 'Add Session'
}
]
return render(request,'plannedsessioncreate.html', return render(request,'plannedsessioncreate.html',
{ {
'teams':get_my_teams(request.user), 'teams':get_my_teams(request.user),
'plan':trainingplan, 'plan':trainingplan,
'dateform':dateform, 'dateform':dateform,
'breadcrumbs':breadcrumbs,
'form':sessioncreateform, 'form':sessioncreateform,
'active':'nav-plan', 'active':'nav-plan',
'plannedsessions':sps, 'plannedsessions':sps,
@@ -676,7 +697,16 @@ def plannedsession_createtemplate_view(request,
sessioncreateform.save_m2m() sessioncreateform.save_m2m()
add_rower_session(r,ps) add_rower_session(r,ps)
url = reverse("template_library_view")
url = reverse('template_library_view')
if '_continue' in request.POST:
url = reverse('plannedsession_templateedit_view',kwargs={
'id':ps.id,
})
elif '_addanother' in request.POST:
url = reverse('plannedsession_createtemplate_view')
return HttpResponseRedirect(url) return HttpResponseRedirect(url)
else: else:
sessioncreateform = PlannedSessionTemplateForm() sessioncreateform = PlannedSessionTemplateForm()
@@ -714,6 +744,10 @@ def plannedsession_createtemplate_view(request,
'url': reverse(plannedsessions_view), 'url': reverse(plannedsessions_view),
'name': 'Sessions' 'name': 'Sessions'
}, },
{
'url':reverse('template_library_view'),
'name': 'Session Library'
},
{ {
'url':reverse(plannedsession_createtemplate_view), 'url':reverse(plannedsession_createtemplate_view),
'name': 'Create Library Session' 'name': 'Create Library Session'
@@ -725,6 +759,7 @@ def plannedsession_createtemplate_view(request,
'teams':get_my_teams(request.user), 'teams':get_my_teams(request.user),
'plan':trainingplan, 'plan':trainingplan,
'form':sessioncreateform, 'form':sessioncreateform,
'breadcrumbs':breadcrumbs,
'active':'nav-plan', 'active':'nav-plan',
'rower':r, 'rower':r,
'alltags':alltags, 'alltags':alltags,
@@ -929,8 +964,17 @@ def plannedsession_teamcreate_view(request,
url = reverse(plannedsessions_view,kwargs={ url = reverse(plannedsessions_view,kwargs={
'userid':userid, 'userid':userid,
}) })
if '_continue' in request.POST:
url = reverse('plannedsession_edit_view',kwargs={
'id':ps.id,
})
elif '_addanother' in request.POST:
url = reverse('plannedsession_create_view',kwargs={'userid':userid})
return HttpResponseRedirect(url) return HttpResponseRedirect(url)
#url = reverse(plannedsession_teamcreate_view) #url = reverse(plannedsession_teamcreate_view)
#startdatestring = startdate.strftime('%Y-%m-%d') #startdatestring = startdate.strftime('%Y-%m-%d')
#enddatestring = enddate.strftime('%Y-%m-%d') #enddatestring = enddate.strftime('%Y-%m-%d')
@@ -1117,17 +1161,20 @@ def plannedsession_teamedit_view(request,
add_rower_session(r,ps) add_rower_session(r,ps)
url = reverse(plannedsession_teamedit_view, url = reverse('plannedsessions_view')
kwargs = {
'id':id,
})
startdatestring = startdate.strftime('%Y-%m-%d') if "_continue" in request.POST:
enddatestring = enddate.strftime('%Y-%m-%d') url = reverse(plannedsession_edit_view,
url += '?when='+startdatestring+'/'+enddatestring kwargs={
'id':int(ps.id),
'userid':r.user.id,
})
next = request.GET.get('next', url) startdatestring = startdate.strftime('%Y-%m-%d')
return HttpResponseRedirect(next) enddatestring = enddate.strftime('%Y-%m-%d')
url += '?when='+startdatestring+'/'+enddatestring
return HttpResponseRedirect(url)
else: else:
sessioncreateform = PlannedSessionForm(instance=ps) sessioncreateform = PlannedSessionForm(instance=ps)
sessionteamselectform = PlannedSessionTeamForm( sessionteamselectform = PlannedSessionTeamForm(
@@ -1820,29 +1867,32 @@ def plannedsession_templateedit_view(request,id=0):
else: else:
messages.error(request,message) messages.error(request,message)
url = reverse(plannedsession_templateedit_view, url = reverse('template_library_view')
kwargs = {
'id':int(ps.id),
})
startdatestring = startdate.strftime('%Y-%m-%d') if '_continue' in request.POST:
enddatestring = enddate.strftime('%Y-%m-%d') url = reverse('plannedsession_templateedit_view',kwargs={
url += '?when='+startdatestring+'/'+enddatestring 'id':ps.id,
next = request.GET.get('next', url) })
return HttpResponseRedirect(next)
return HttpResponseRedirect(url)
breadcrumbs = [ breadcrumbs = [
{ {
'url': reverse(plannedsessions_view), 'url': reverse(plannedsessions_view),
'name': 'Sessions' 'name': 'Sessions'
}, },
{
'url': reverse('template_library_view'),
'name': 'Library',
},
{ {
'url':reverse(plannedsession_templateedit_view, 'url':reverse(plannedsession_templateedit_view,
kwargs={ kwargs={
'id':id, 'id':id,
} }
), ),
'name': 'Edit' 'name': 'Edit Session'
} }
] ]
@@ -1946,15 +1996,18 @@ def plannedsession_edit_view(request,id=0,userid=0):
else: else:
messages.error(request,message) messages.error(request,message)
url = reverse(plannedsession_edit_view, url = reverse('plannedsessions_view')
kwargs={
'id':int(ps.id),
'userid':r.user.id,
})
startdatestring = startdate.strftime('%Y-%m-%d') if "_continue" in request.POST:
enddatestring = enddate.strftime('%Y-%m-%d') url = reverse(plannedsession_edit_view,
url += '?when='+startdatestring+'/'+enddatestring kwargs={
'id':int(ps.id),
'userid':r.user.id,
})
startdatestring = startdate.strftime('%Y-%m-%d')
enddatestring = enddate.strftime('%Y-%m-%d')
url += '?when='+startdatestring+'/'+enddatestring
return HttpResponseRedirect(url) return HttpResponseRedirect(url)
else: else: