diff --git a/rowers/templates/plannedsession_multicreate.html b/rowers/templates/plannedsession_multicreate.html index d1be9b95..5abb9384 100644 --- a/rowers/templates/plannedsession_multicreate.html +++ b/rowers/templates/plannedsession_multicreate.html @@ -92,10 +92,14 @@ {% endfor %} - Add More + Add More +
TRIMP has no unit
"); } if (this.value == 'distance') { $( myrow ).find("*[id*=sessionunit]").prop('value','m'); + $('#id_guidance').html("Distance: Set value to meters
"); } if (this.value == 'time') { $( myrow ).find("*[id*=sessionunit]").prop('value','min'); + $('#id_guidance').html("Time: Set value to minutes
"); } if (this.value == 'rScore') { $( myrow ).find("*[id*=sessionunit]").prop('value','None'); + $('#id_guidance').html("rScore has no unit
"); + } }); + $( myrow ).find('*[id*=sessionunit]').change(function() { if (this.value == 'km') { $( myrow ).find("*[id*=sessionmode]").prop('value','distance'); + $('#id_guidance').html("Mode was set to distance
"); } if (this.value == 'm') { $( myrow ).find("*[id*=sessionmode]").prop('value','distance'); + $('#id_guidance').html("Mode was set to distance
"); } if (this.value == 'None') { $( myrow ).find("*[id*=sessionmode]").prop('value','rScore'); + $('#id_guidance').html("Mode was set to rScore
"); } if (this.value == 'min') { $( myrow ).find("*[id*=sessionmode]").prop('value','time'); + $('#id_guidance').html("Mode was set to time
"); } }); + + $( myrow ).find('*[id*=sessiontype]').change(function() { + if (this.value == 'session') { + $( myrow ).find("*[id*=criterium]").prop("value","none"); + $('#id_guidance').html("For Training Sessions, the default criterium is 'Approximately'
"); + } + + if (this.value == 'challenge') { + $( myrow ).find("*[id*=criterium]").prop("value","minimum"); + $('#id_guidance').html("For Challenges, the default criterium is 'At Least'
"); + } + + if (this.value == 'cycletarget') { + $( myrow ).find("*[id*=criterium]").prop("value","none"); + $('#id_guidance').html("For Cycle Targets, the default criterium is 'Approximately'
"); + } + + if (this.value == 'test') { + $( myrow ).find("*[id*=criterium]").prop("value","exact"); + $( myrow ).find("*[id*=sessionmode]").prop("value","distance"); + $( myrow ).find("*[id*=sessionunit]").prop("value","m"); + $('#id_guidance').html("Set mode to distance. For Mandatory Tests, only distance or time are allowed.
For Mandatory Tests, the only criterium is 'Exactly'
"); + } + }); + + + }); + }); diff --git a/rowers/templates/plannedsessioncreate.html b/rowers/templates/plannedsessioncreate.html index 6a03f149..b99a9860 100644 --- a/rowers/templates/plannedsessioncreate.html +++ b/rowers/templates/plannedsessioncreate.html @@ -124,6 +124,9 @@ +TRIMP has no unit
"); } if (this.value == 'distance') { $("td #id_sessionunit").prop("value","m"); + $('#id_guidance').html("Distance: Set value to meters
"); } if (this.value == 'time') { $("td #id_sessionunit").prop("value","min"); + $('#id_guidance').html("Time: Set value to minutes
"); } if (this.value == 'rScore') { $("td #id_sessionunit").prop("value","None"); + $('#id_guidance').html("rScore has no unit
"); } }); @@ -152,18 +159,22 @@ if (this.value == 'session') { $("td #id_criterium").prop("value","none"); + $('#id_guidance').html("For Training Sessions, the default criterium is 'Approximately'
"); } if (this.value == 'test') { $("td #id_criterium").prop("value","exact"); $("td #id_sessionmode").prop("value","distance"); $("td #id_sessionunit").prop("value","m"); + $('#id_guidance').html("Set mode to distance. For Mandatory Tests, only distance or time are allowed.
For Mandatory Tests, the only criterium is 'Exactly'
"); } if (this.value == 'challenge') { $("td #id_criterium").prop("value","minimum"); + $('#id_guidance').html("For Challenges, the default criterium is 'At Least'
"); } if (this.value == 'cycletarget') { $("td #id_criterium").prop("value","none"); + $('#id_guidance').html("For Cycle Targets, the default criterium is 'Approximately'
"); } } @@ -174,21 +185,27 @@ if (this.value == 'm') { $("td #id_sessionmode").prop("value","distance"); + $('#id_guidance').html("Mode was set to distance
"); } if (this.value == 'km') { $("td #id_sessionmode").prop("value","distance"); + $('#id_guidance').html("Mode was set to distance
"); } if (this.value == 'None') { $("td #id_sessionmode").prop("value","rScore"); + $('#id_guidance').html("Mode was set to rScore
"); } if (this.value == 'min') { $("td #id_sessionmode").prop("value","time"); + $('#id_guidance').html("Mode was set to time
"); } } ); + + }); diff --git a/rowers/templates/plannedsessionedit.html b/rowers/templates/plannedsessionedit.html index 9021105f..9d82ed58 100644 --- a/rowers/templates/plannedsessionedit.html +++ b/rowers/templates/plannedsessionedit.html @@ -124,6 +124,10 @@ +TRIMP has no unit
"); } if (this.value == 'distance') { $("td #id_sessionunit").prop("value","m"); + $('#id_guidance').html("Distance: Set value to meters
"); } if (this.value == 'time') { $("td #id_sessionunit").prop("value","min"); + $('#id_guidance').html("Time: Set value to minutes
"); } if (this.value == 'rScore') { $("td #id_sessionunit").prop("value","None"); + $('#id_guidance').html("rScore has no unit
"); } }); @@ -157,18 +165,22 @@ if (this.value == 'session') { $("td #id_criterium").prop("value","none"); + $('#id_guidance').html("For Training Sessions, the default criterium is 'Approximately'
"); } if (this.value == 'test') { $("td #id_criterium").prop("value","exact"); $("td #id_sessionmode").prop("value","distance"); $("td #id_sessionunit").prop("value","m"); + $('#id_guidance').html("Set mode to distance. For Mandatory Tests, only distance or time are allowed.
For Mandatory Tests, the only criterium is 'Exactly'
"); } if (this.value == 'challenge') { $("td #id_criterium").prop("value","minimum"); + $('#id_guidance').html("For Challenges, the default criterium is 'At Least'
"); } if (this.value == 'cycletarget') { $("td #id_criterium").prop("value","none"); + $('#id_guidance').html("For Cycle Targets, the default criterium is 'Approximately'
"); } } @@ -179,15 +191,19 @@ if (this.value == 'm') { $("td #id_sessionmode").prop("value","distance"); + $('#id_guidance').html("Mode was set to distance
"); } if (this.value == 'km') { $("td #id_sessionmode").prop("value","distance"); + $('#id_guidance').html("Mode was set to distance
"); } if (this.value == 'None') { $("td #id_sessionmode").prop("value","rScore"); + $('#id_guidance').html("Mode was set to rScore
"); } if (this.value == 'min') { $("td #id_sessionmode").prop("value","time"); + $('#id_guidance').html("Mode was set to time
"); } } @@ -199,4 +215,5 @@ }); + {% endblock %} diff --git a/rowers/templates/plannedsessionteamcreate.html b/rowers/templates/plannedsessionteamcreate.html index 24169c2e..bbe17b60 100644 --- a/rowers/templates/plannedsessionteamcreate.html +++ b/rowers/templates/plannedsessionteamcreate.html @@ -116,6 +116,9 @@ +TRIMP has no unit
"); } if (this.value == 'distance') { $("td #id_sessionunit").prop("value","m"); + $('#id_guidance').html("Distance: Set value to meters
"); } if (this.value == 'time') { $("td #id_sessionunit").prop("value","min"); + $('#id_guidance').html("Time: Set value to minutes
"); } if (this.value == 'rScore') { $("td #id_sessionunit").prop("value","None"); + $('#id_guidance').html("rScore has no unit
"); } }); @@ -162,18 +170,22 @@ if (this.value == 'session') { $("td #id_criterium").prop("value","none"); + $('#id_guidance').html("For Training Sessions, the default criterium is 'Approximately'
"); } if (this.value == 'test') { $("td #id_criterium").prop("value","exact"); $("td #id_sessionmode").prop("value","distance"); $("td #id_sessionunit").prop("value","m"); + $('#id_guidance').html("Set mode to distance. For Mandatory Tests, only distance or time are allowed.
For Mandatory Tests, the only criterium is 'Exactly'
"); } if (this.value == 'challenge') { $("td #id_criterium").prop("value","minimum"); + $('#id_guidance').html("For Challenges, the default criterium is 'At Least'
"); } if (this.value == 'cycletarget') { $("td #id_criterium").prop("value","none"); + $('#id_guidance').html("For Cycle Targets, the default criterium is 'Approximately'
"); } } @@ -184,15 +196,19 @@ if (this.value == 'm') { $("td #id_sessionmode").prop("value","distance"); + $('#id_guidance').html("Mode was set to distance
"); } if (this.value == 'km') { $("td #id_sessionmode").prop("value","distance"); + $('#id_guidance').html("Mode was set to distance
"); } if (this.value == 'None') { $("td #id_sessionmode").prop("value","rScore"); + $('#id_guidance').html("Mode was set to rScore
"); } if (this.value == 'min') { $("td #id_sessionmode").prop("value","time"); + $('#id_guidance').html("Mode was set to time
"); } } diff --git a/rowers/views.py b/rowers/views.py index 9fb0e830..d80cc5f1 100644 --- a/rowers/views.py +++ b/rowers/views.py @@ -11844,7 +11844,7 @@ def plannedsession_teamcreate_view(request,timeperiod='thisweek', 'teamform':sessionteamselectform, 'timeperiod':timeperiod, 'plannedsessions':sps, - 'rower':r, + 'rower':getrower(request.user), }) # Manager edits sessions for entire team diff --git a/static/admin/js/plannedsessions.js b/static/admin/js/plannedsessions.js new file mode 100644 index 00000000..93944405 --- /dev/null +++ b/static/admin/js/plannedsessions.js @@ -0,0 +1,77 @@ + + + $(document).ready(function(){ + $("td #id_sessionmode").change(function() { + + if (this.value == 'TRIMP') { + $("td #id_sessionunit").prop("value","None"); + $('#id_guidance').html("TRIMP has no unit
"); + } + if (this.value == 'distance') { + $("td #id_sessionunit").prop("value","m"); + $('#id_guidance').html("Distance: Set value to meters
"); + } + if (this.value == 'time') { + $("td #id_sessionunit").prop("value","min"); + $('#id_guidance').html("Time: Set value to minutes
"); + } + + if (this.value == 'rScore') { + $("td #id_sessionunit").prop("value","None"); + $('#id_guidance').html("rScore has no unit
"); + } + + }); + + $("td #id_sessiontype").change(function() { + + if (this.value == 'session') { + $("td #id_criterium").prop("value","none"); + $('#id_guidance').html("For Training Sessions, the default criterium is 'Approximately'
"); + } + if (this.value == 'test') { + $("td #id_criterium").prop("value","exact"); + $("td #id_sessionmode").prop("value","distance"); + $("td #id_sessionunit").prop("value","m"); + $('#id_guidance').html("Set mode to distance. For Mandatory Tests, only distance or time are allowed.
For Mandatory Tests, the only criterium is 'Exactly'
"); + } + if (this.value == 'challenge') { + $("td #id_criterium").prop("value","minimum"); + $('#id_guidance').html("For Challenges, the default criterium is 'At Least'
"); + } + + if (this.value == 'cycletarget') { + $("td #id_criterium").prop("value","none"); + $('#id_guidance').html("For Cycle Targets, the default criterium is 'Approximately'
"); + } + + } + + ); + + $("td #id_sessionunit").change(function() { + + if (this.value == 'm') { + $("td #id_sessionmode").prop("value","distance"); + $('#id_guidance').html("Mode was set to distance
"); + } + if (this.value == 'km') { + $("td #id_sessionmode").prop("value","distance"); + $('#id_guidance').html("Mode was set to distance
"); + } + if (this.value == 'None') { + $("td #id_sessionmode").prop("value","rScore"); + $('#id_guidance').html("Mode was set to rScore
"); + } + if (this.value == 'min') { + $("td #id_sessionmode").prop("value","time"); + $('#id_guidance').html("Mode was set to time
"); + } + + } + + ); + + + + }); diff --git a/static/js/plannedsessions.js b/static/js/plannedsessions.js new file mode 100644 index 00000000..93944405 --- /dev/null +++ b/static/js/plannedsessions.js @@ -0,0 +1,77 @@ + + + $(document).ready(function(){ + $("td #id_sessionmode").change(function() { + + if (this.value == 'TRIMP') { + $("td #id_sessionunit").prop("value","None"); + $('#id_guidance').html("TRIMP has no unit
"); + } + if (this.value == 'distance') { + $("td #id_sessionunit").prop("value","m"); + $('#id_guidance').html("Distance: Set value to meters
"); + } + if (this.value == 'time') { + $("td #id_sessionunit").prop("value","min"); + $('#id_guidance').html("Time: Set value to minutes
"); + } + + if (this.value == 'rScore') { + $("td #id_sessionunit").prop("value","None"); + $('#id_guidance').html("rScore has no unit
"); + } + + }); + + $("td #id_sessiontype").change(function() { + + if (this.value == 'session') { + $("td #id_criterium").prop("value","none"); + $('#id_guidance').html("For Training Sessions, the default criterium is 'Approximately'
"); + } + if (this.value == 'test') { + $("td #id_criterium").prop("value","exact"); + $("td #id_sessionmode").prop("value","distance"); + $("td #id_sessionunit").prop("value","m"); + $('#id_guidance').html("Set mode to distance. For Mandatory Tests, only distance or time are allowed.
For Mandatory Tests, the only criterium is 'Exactly'
"); + } + if (this.value == 'challenge') { + $("td #id_criterium").prop("value","minimum"); + $('#id_guidance').html("For Challenges, the default criterium is 'At Least'
"); + } + + if (this.value == 'cycletarget') { + $("td #id_criterium").prop("value","none"); + $('#id_guidance').html("For Cycle Targets, the default criterium is 'Approximately'
"); + } + + } + + ); + + $("td #id_sessionunit").change(function() { + + if (this.value == 'm') { + $("td #id_sessionmode").prop("value","distance"); + $('#id_guidance').html("Mode was set to distance
"); + } + if (this.value == 'km') { + $("td #id_sessionmode").prop("value","distance"); + $('#id_guidance').html("Mode was set to distance
"); + } + if (this.value == 'None') { + $("td #id_sessionmode").prop("value","rScore"); + $('#id_guidance').html("Mode was set to rScore
"); + } + if (this.value == 'min') { + $("td #id_sessionmode").prop("value","time"); + $('#id_guidance').html("Mode was set to time
"); + } + + } + + ); + + + + });