mirror of
https://github.com/fspc/Yellow-Bike-Database.git
synced 2025-02-23 01:03:23 -05:00
Finally have the values rendering properly.
This commit is contained in:
parent
793fcb42e1
commit
81e261bc6a
@ -721,49 +721,35 @@ $(function() {
|
|||||||
if (volunteer_hours && volunteer_hours.length) {
|
if (volunteer_hours && volunteer_hours.length) {
|
||||||
$("#volunteer_hours").prop("title",title).html("Volunteer Hours");
|
$("#volunteer_hours").prop("title",title).html("Volunteer Hours");
|
||||||
|
|
||||||
$(".ui-spinner").show();
|
$(".ui-spinner").show();
|
||||||
|
|
||||||
/*
|
|
||||||
$( "#redeemable_hours" ).spinner({
|
|
||||||
step: 0.10,
|
|
||||||
numberFormat: "n",
|
|
||||||
spin: function( event, ui ) {
|
|
||||||
if ( ui.value > obj.current_year_volunteer_hours ) {
|
|
||||||
$( this ).spinner( "value", obj.current_year_volunteer_hours );
|
|
||||||
return false;
|
|
||||||
} else if (ui.value < 0) {
|
|
||||||
$( this ).spinner( "value", 0 );
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}).show();
|
|
||||||
|
|
||||||
*/
|
var redeemable_value = obj.current_year_volunteer_hours * obj.volunteer_hour_value;
|
||||||
|
|
||||||
$("#redeemable_hours").spinner({
|
$("#redeemable_hours").spinner({
|
||||||
step: 0.01,
|
step: 0.01,
|
||||||
numberFormat: "n",
|
numberFormat: "n",
|
||||||
max: obj.current_year_volunteer_hours,
|
max: obj.current_year_volunteer_hours,
|
||||||
min: 0
|
min: 0,
|
||||||
}).on('input', function () {
|
spin: function( event, ui ) { console.log(ui.value); }
|
||||||
|
}).on('input', function (e) {
|
||||||
|
var price = amount.val();
|
||||||
if ($(this).data('onInputPrevented')) return;
|
if ($(this).data('onInputPrevented')) return;
|
||||||
var val = this.value,
|
// test if value is greater than current_year_volunteer_hours
|
||||||
$this = $(this),
|
// console.log($(this).spinner("value"));
|
||||||
max = $this.spinner('option', 'max'),
|
var val = this.value,
|
||||||
min = $this.spinner('option', 'min');
|
$this = $(this),
|
||||||
// We want only number, no alpha.
|
max = $this.spinner('option', 'max'),
|
||||||
// We set it to previous default value.
|
min = $this.spinner('option', 'min');
|
||||||
//[+-]?[\d]{0,} [+-]?([0-9]*[.])?[0-9]+ [+-]?([0-9]+([.][0-9]*)?|[.][0-9]+)
|
// We set it to previous default value.
|
||||||
if (!val.match(/^[+-]?([0-9]+([.][0-9]*)?|[.][0-9]+)$/)) val = $(this).data('defaultValue');
|
//[+-]?[\d]{0,} [+-]?([0-9]*[.])?[0-9]+ [+-]?([0-9]+([.][0-9]*)?|[.][0-9]+)
|
||||||
this.value = val > max ? max : val < min ? min : val;
|
if (!val.match(/^[+-]?([0-9]+([.][0-9]*)?|[.][0-9]+)$/)) val = $(this).data('defaultValue');
|
||||||
}).on('keydown', function (e) {
|
this.value = val > max ? max : val < min ? min : val;
|
||||||
// we set default value for spinner.
|
// set default value for spinner
|
||||||
if (!$(this).data('defaultValue')) $(this).data('defaultValue', this.value);
|
if (!$(this).data('defaultValue')) $(this).data('defaultValue', "");
|
||||||
// To handle backspace
|
// To handle backspace
|
||||||
$(this).data('onInputPrevented', e.which === 8 ? true : false);
|
$(this).data('onInputPrevented', e.which === 8 ? true : false);
|
||||||
}).show();
|
}).show();
|
||||||
|
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
$("#volunteer_hours").prop("title","").empty();
|
$("#volunteer_hours").prop("title","").empty();
|
||||||
$("#redeemable_hours").hide();
|
$("#redeemable_hours").hide();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user