Private
Public Access
1
0

including time range

This commit is contained in:
Sander Roosendaal
2022-07-20 08:10:05 +02:00
parent 973f863b92
commit 4646027ec6
3 changed files with 74 additions and 28 deletions

View File

@@ -64,18 +64,40 @@ $( function() {
max: 60,
values: [ {{ spm_min }}, {{ spm_max }} ],
slide: function( event, ui ) {
$( "#amountspm" ).val(ui.values[ 0 ] + " - " + ui.values[ 1 ] );
$( "#id_spm_min" ).val( ui.values[ 0 ]);
$( "#id_spm_max" ).val(ui.values[ 1 ] );
$( "#spm_min_info" ).text( ui.values[ 0 ]);
$( "#spm_max_info" ).text(ui.values[ 1 ] );
}
});
$( "#amountspm" ).val($( "#slider-range" ).slider( "values", 0 ) +
" - " + $( "#slider-range" ).slider( "values", 1 ));
} );
</script>
<script>
$("#instrokeform").mouseup(function() {
submit_form();
});
</script>
<script>
$( function() {
console.log({{ activeminutesmin }}, {{ activeminutesmax}}, 'active range');
$( "#slider-timerange" ).slider({
range: true,
min: 0,
max: {{ maxminutes }},
values: [ {{ activeminutesmin }}, {{ activeminutesmax }} ],
slide: function( event, ui ) {
$( "#amount" ).val(ui.values[ 0 ] + " min - " + ui.values[ 1 ] + " min " );
$("#id_activeminutesmin").val(ui.values[0]);
$("#id_activeminutesmax").val(ui.values[1]);
}
});
$( "#amount" ).val($( "#slider-timerange" ).slider( "values", 0 ) +
" min - " + $( "#slider-timerange" ).slider( "values", 1 ) + " min ");
} );
</script>
{% endblock %}
@@ -97,6 +119,25 @@ $( function() {
<h1>In Stroke Metrics</h1>
<ul class="main-content">
<li class="grid_4">
<form id="instrokeform" enctype="multipart/form-data" action="" method="post">
{% csrf_token %}
<table>
{{ form.as_table }}
</table>
<div id="slider-range"></div>
<p>
<label for="amountspm">Active Range:</label>
<input type="text" id="amountspm" readonly style="border:0; color:#1c75bc; font-weight:bold;">
</p>
<div id="slider-timerange"></div>
<p>
<label for="amount">Active Range:</label>
<input type="text" id="amount" readonly style="border:0; color:#1c75bc; font-weight:bold;">
</p>
<input name='form' class="button" type="submit" value="Submit">
</form>
</li>
<li class="grid_4">
<div id="dd" class="flexplot">
{{ dd|safe }}
@@ -107,22 +148,6 @@ $( function() {
{{ the_div|safe }}
</div>
</li>
<li class="grid_4">
<form id="instrokeform" enctype="multipart/form-data" action="" method="post">
{% csrf_token %}
<table>
{{ form.as_table }}
</table>
<div id="slider-container">
<span>SPM (slide to change):</span>
<span id="spm_min_info">{{ spm_min }}</span>
<span>&nbsp;-&nbsp;</span>
<span id="spm_max_info">{{ spm_max }}</span>
<hr id="slider-range" />
</div>
<input name='form' class="button" type="submit" value="Submit">
</form>
</li>
</ul>