Remove unneeded answer stylers
These all have VFormat alternatives. * src/ui/ElementStyler.js (_answerStylers): Removedmaster
parent
f5549795d5
commit
2a6b170ac9
|
@ -84,44 +84,6 @@ module.exports = Class( 'ElementStyler',
|
||||||
|
|
||||||
|
|
||||||
_answerStyles: {
|
_answerStyles: {
|
||||||
'currency': function( value )
|
|
||||||
{
|
|
||||||
var pre = '$';
|
|
||||||
|
|
||||||
if ( !value )
|
|
||||||
{
|
|
||||||
value = 0;
|
|
||||||
}
|
|
||||||
else if ( value < 0 )
|
|
||||||
{
|
|
||||||
value *= -1;
|
|
||||||
pre = '-$';
|
|
||||||
}
|
|
||||||
|
|
||||||
var formatter = this._getAnswerStyler( 'number' );
|
|
||||||
|
|
||||||
return pre + formatter.call( this, ( +value ).toFixed( 2 ) );
|
|
||||||
},
|
|
||||||
|
|
||||||
'dollars': function( value )
|
|
||||||
{
|
|
||||||
var formatter = this._getAnswerStyler( 'currency' );
|
|
||||||
|
|
||||||
return formatter.call( this, ( +value ).toFixed( 0 ) );
|
|
||||||
},
|
|
||||||
|
|
||||||
'float': function( value )
|
|
||||||
{
|
|
||||||
if ( !value )
|
|
||||||
{
|
|
||||||
value = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
var formatter = this._getAnswerStyler( 'number' );
|
|
||||||
|
|
||||||
return formatter.call( this, ( +value ).toFixed( 2 ) );
|
|
||||||
},
|
|
||||||
|
|
||||||
'limit': function( value, _, default_val )
|
'limit': function( value, _, default_val )
|
||||||
{
|
{
|
||||||
value = ( value + '' ).replace( ',', '' );
|
value = ( value + '' ).replace( ',', '' );
|
||||||
|
@ -254,7 +216,6 @@ module.exports = Class( 'ElementStyler',
|
||||||
return ret;
|
return ret;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
||||||
'includeExclude': function( value, _, default_val )
|
'includeExclude': function( value, _, default_val )
|
||||||
{
|
{
|
||||||
// use the default if no value
|
// use the default if no value
|
||||||
|
@ -268,7 +229,6 @@ module.exports = Class( 'ElementStyler',
|
||||||
: 'Included';
|
: 'Included';
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* display as a limit, rejected or default if available
|
* display as a limit, rejected or default if available
|
||||||
*/
|
*/
|
||||||
|
@ -298,31 +258,6 @@ module.exports = Class( 'ElementStyler',
|
||||||
return ret;
|
return ret;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* format thousands
|
|
||||||
*/
|
|
||||||
'number': function( value )
|
|
||||||
{
|
|
||||||
var str = value.toString().split( '.' );
|
|
||||||
var len = str[0].length,
|
|
||||||
ret = '';
|
|
||||||
|
|
||||||
for ( var i = 0; i < len; i++ )
|
|
||||||
{
|
|
||||||
ret += str[0].charAt( i );
|
|
||||||
|
|
||||||
if ( ( ( len - i ) % 3 ) === 1 )
|
|
||||||
{
|
|
||||||
ret += ',';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
str[0] = ret.replace( /,$/, '' );
|
|
||||||
|
|
||||||
return str.join( '.' )
|
|
||||||
},
|
|
||||||
|
|
||||||
'state': function( value )
|
'state': function( value )
|
||||||
{
|
{
|
||||||
return State.getName( value );
|
return State.getName( value );
|
||||||
|
@ -367,27 +302,6 @@ module.exports = Class( 'ElementStyler',
|
||||||
: val;
|
: val;
|
||||||
},
|
},
|
||||||
|
|
||||||
'manualDate': function( value )
|
|
||||||
{
|
|
||||||
if( value.replace )
|
|
||||||
{
|
|
||||||
return value.replace(
|
|
||||||
/^([0-9]{4})-([0-9]+)-([0-9]+)$/,
|
|
||||||
'$2/$3/$1'
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
return null;
|
|
||||||
},
|
|
||||||
|
|
||||||
'date': function( value )
|
|
||||||
{
|
|
||||||
var data = value.split( '-' );
|
|
||||||
|
|
||||||
// m/d/y
|
|
||||||
return data[1] + '/' + data[2] + '/' + data[0];
|
|
||||||
},
|
|
||||||
|
|
||||||
'dateTime': function( value )
|
'dateTime': function( value )
|
||||||
{
|
{
|
||||||
var ret_val = new Date( ( +value ) * 1000 );
|
var ret_val = new Date( ( +value ) * 1000 );
|
||||||
|
|
Loading…
Reference in New Issue