Private
Public Access
1
0

some fine tuning of plannedsession UI

This commit is contained in:
Sander Roosendaal
2018-02-14 11:27:17 +01:00
parent 55513c8470
commit 76cadea8b6
8 changed files with 166 additions and 43 deletions

View File

@@ -2,7 +2,7 @@
{% load staticfiles %}
{% load rowerfilters %}
{% block title %}New Planned Session{% endblock %}
{% block title %}Plan entire microcycle{% endblock %}
{% block content %}
<div class="grid_12 alpha">
@@ -55,7 +55,12 @@
<div class="grid_12 alpha">
<p>
On this page, you can create and edit sessions for an entire time
period.
period. You see a list of the current sessions planned for the
selected time period. Each row in the table is a session. You can
remove a session by clicking "remove" at the end of a row.
You can edit the date in the forms. If you need to add a new session,
click the "Add More" button to add a new session. Use the "Submit"
button to commit any changes you made.
</p>
<form id="ps-form-table" method="post">
{% csrf_token %}
@@ -71,7 +76,7 @@
</thead>
<tbody>
{% for form in ps_formset %}
<tr id="id_form_row">
<tr class="session_form_row">
<td> {{ forloop.counter }}
{% if form.instance.pk %}{{ form.DELETE }}{% endif %}
{{ form.id }}
@@ -105,40 +110,40 @@
addText: ''
});
$("td #id_sessionmode").change(function() {
$("tr.session_form_row").each(function() {
var myrow = this;
$( myrow ).find('*[id*=sessionmode]').change(function() {
if (this.value == 'TRIMP') {
$("td #id_sessionunit").prop("value","None");
$( myrow ).find("*[id*=sessionunit]").prop('value','None');
}
if (this.value == 'distance') {
$("td #id_sessionunit").prop("value","m");
$( myrow ).find("*[id*=sessionunit]").prop('value','m');
}
if (this.value == 'time') {
$("td #id_sessionunit").prop("value","min");
$( myrow ).find("*[id*=sessionunit]").prop('value','min');
}
if (this.value == 'rScore') {
$("td #id_sessionunit").prop("value","None");
$( myrow ).find("*[id*=sessionunit]").prop('value','None');
}
});
$("td #id_sessiontype").change(function() {
if (this.value == 'session') {
$("td #id_criterium").prop("value","none");
$( myrow ).find('*[id*=sessionunit]').change(function() {
if (this.value == 'km') {
$( myrow ).find("*[id*=sessionmode]").prop('value','distance');
}
if (this.value == 'test') {
$("td #id_criterium").prop("value","exact");
if (this.value == 'm') {
$( myrow ).find("*[id*=sessionmode]").prop('value','distance');
}
if (this.value == 'challenge') {
$("td #id_criterium").prop("value","minimum");
if (this.value == 'None') {
$( myrow ).find("*[id*=sessionmode]").prop('value','rScore');
}
if (this.value == 'min') {
$( myrow ).find("*[id*=sessionmode]").prop('value','time');
}
);
});
});
});