Private
Public Access
1
0

jquery changes in forms with boat type

This commit is contained in:
Sander Roosendaal
2018-11-14 14:59:16 +01:00
parent 032a2e2067
commit fc5ee4517d
5 changed files with 71 additions and 46 deletions

View File

@@ -10,6 +10,34 @@ workouttypes = (
('coastal','Coastal'), ('coastal','Coastal'),
('c-boat','Dutch C boat'), ('c-boat','Dutch C boat'),
('churchboat','Finnish Church boat'), ('churchboat','Finnish Church boat'),
('Ride','Ride'),
('Kitesurf','Kitesurf'),
('Run','Run'),
('NordicSki','NordicSki'),
('Swim','Swim'),
('RockClimbing','RockClimbing'),
('Hike','Hike'),
('RollerSki','RollerSki'),
('Walk','Walk'),
('AlpineSki','AlpineSki'),
('Snowboard','Snowboard'),
('BackcountrySki','BackcountrySki'),
('Snowshoe','Snowshoe'),
('Canoeing','Canoeing'),
('StairStepper','StairStepper'),
('Crossfit','Crossfit'),
('StandUpPaddling','StandUpPaddling'),
('EBikeRide','EBikeRide'),
('Surfing','Surfing'),
('Elliptical','Elliptical'),
('VirtualRide','VirtualRide'),
('IceSkate','IceSkate'),
('WeightTraining','WeightTraining'),
('InlineSkate','InlineSkate'),
('Windsurf','Windsurf'),
('Kayaking','Kayaking'),
('Workout','Workout'),
('Yoga','Yoga'),
('other','Other'), ('other','Other'),
) )
@@ -20,6 +48,15 @@ otwtypes = (
'churchboat' 'churchboat'
) )
rowtypes = (
'water',
'rower',
'dynamic',
'slides',
'coastal',
'c-boat',
'churchboat'
)
checktypes = [i[0] for i in workouttypes] checktypes = [i[0] for i in workouttypes]

View File

@@ -83,18 +83,15 @@
$( document ).ready(function() { $( document ).ready(function() {
$('#id_workouttype').on('change', function(){ $('#id_workouttype').on('change', function(){
if ( if (
$(this).val() == 'rower' $(this).val() == 'water'
|| $(this).val() == 'skierg' || $(this).val() == 'coastal'
|| $(this).val() == 'dynamic' || $(this).val() == 'c-boat'
|| $(this).val() == 'slides' || $(this).val() == 'churchboat'
|| $(this).val() == 'paddle'
|| $(this).val() == 'bike'
|| $(this).val() == 'snow'
) { ) {
$('#id_boattype').toggle(true);
} else {
$('#id_boattype').toggle(false); $('#id_boattype').toggle(false);
$('#id_boattype').val('1x'); $('#id_boattype').val('1x');
} else {
$('#id_boattype').toggle(true);
} }
}); });
$('#id_workouttype').change(); $('#id_workouttype').change();

View File

@@ -16,18 +16,15 @@
$( document ).ready(function() { $( document ).ready(function() {
$('#id_workouttype').on('change', function(){ $('#id_workouttype').on('change', function(){
if ( if (
$(this).val() == 'rower' $(this).val() == 'water'
|| $(this).val() == 'skierg' || $(this).val() == 'coastal'
|| $(this).val() == 'dynamic' || $(this).val() == 'c-boat'
|| $(this).val() == 'slides' || $(this).val() == 'churchboat'
|| $(this).val() == 'paddle'
|| $(this).val() == 'bike'
|| $(this).val() == 'snow'
) { ) {
$('#id_boattype').toggle(true);
} else {
$('#id_boattype').toggle(false); $('#id_boattype').toggle(false);
$('#id_boattype').val('1x'); $('#id_boattype').val('1x');
} else {
$('#id_boattype').toggle(true);
} }
}); });
$('#id_workouttype').change(); $('#id_workouttype').change();

View File

@@ -76,25 +76,22 @@
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js"></script> <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js"></script>
<script> <script>
$( document ).ready(function() { $( document ).ready(function() {
$('#id_workouttype').on('change', function(){ $('#id_workouttype').on('change', function(){
if ( if (
$(this).val() == 'rower' $(this).val() == 'water'
|| $(this).val() == 'skierg' || $(this).val() == 'coastal'
|| $(this).val() == 'dynamic' || $(this).val() == 'c-boat'
|| $(this).val() == 'slides' || $(this).val() == 'churchboat'
|| $(this).val() == 'paddle' ) {
|| $(this).val() == 'bike' $('#id_boattype').toggle(true);
|| $(this).val() == 'snow' } else {
) { $('#id_boattype').toggle(false);
$('#id_boattype').toggle(false); $('#id_boattype').val('1x');
$('#id_boattype').val('1x'); }
} else { });
$('#id_boattype').toggle(true); $('#id_workouttype').change();
} });
});
$('#id_workouttype').change();
});
</script> </script>
{% endblock %} {% endblock %}

View File

@@ -23,18 +23,15 @@
$( document ).ready(function() { $( document ).ready(function() {
$('#id_workouttype').on('change', function(){ $('#id_workouttype').on('change', function(){
if ( if (
$(this).val() == 'rower' $(this).val() == 'water'
|| $(this).val() == 'skierg' || $(this).val() == 'coastal'
|| $(this).val() == 'dynamic' || $(this).val() == 'c-boat'
|| $(this).val() == 'slides' || $(this).val() == 'churchboat'
|| $(this).val() == 'paddle'
|| $(this).val() == 'snow'
|| $(this).val() == 'bike'
) { ) {
$('#id_boattype').toggle(true);
} else {
$('#id_boattype').toggle(false); $('#id_boattype').toggle(false);
$('#id_boattype').val('1x'); $('#id_boattype').val('1x');
} else {
$('#id_boattype').toggle(true);
} }
}); });
$('#id_workouttype').change(); $('#id_workouttype').change();