Minor StepUi cleanup
parent
215869e1ea
commit
1c4554dd0d
|
@ -288,14 +288,15 @@ module.exports = Class( 'StepUi' )
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Will mark the step as dirty when the content is changed and update the
|
* Will mark the step as dirty when the content is changed and update
|
||||||
* staging bucket
|
* the staging bucket
|
||||||
*
|
*
|
||||||
* @return undefined
|
* @return undefined
|
||||||
*/
|
*/
|
||||||
setDirtyTrigger: function()
|
setDirtyTrigger: function()
|
||||||
{
|
{
|
||||||
var step = this;
|
var step = this;
|
||||||
|
|
||||||
this.$content.bind( 'change.program', function( event )
|
this.$content.bind( 'change.program', function( event )
|
||||||
{
|
{
|
||||||
// do nothing if the step is locked
|
// do nothing if the step is locked
|
||||||
|
@ -328,19 +329,23 @@ module.exports = Class( 'StepUi' )
|
||||||
{
|
{
|
||||||
index = 0;
|
index = 0;
|
||||||
}
|
}
|
||||||
else if ( $element.attr( 'type' ) === 'radio' || $element.attr( 'type' ) === 'checkbox' )
|
else if ( $element.attr( 'type' ) === 'radio'
|
||||||
|
|| $element.attr( 'type' ) === 'checkbox'
|
||||||
|
)
|
||||||
{
|
{
|
||||||
// if it's not checked, then this isn't the radio we're
|
// if it's not checked, then this isn't the radio we're
|
||||||
// interested in. Sorry!
|
// interested in. Sorry!
|
||||||
if ( !( $element.attr( 'checked' ) ) )
|
if ( !( $element.attr( 'checked' ) ) )
|
||||||
{
|
{
|
||||||
$element.attr( 'checked', true )
|
$element.attr( 'checked', true );
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 2 in this instance is the yes/no group length.
|
// 2 in this instance is the yes/no group length.
|
||||||
var group_length = $element.attr( 'data-question-length' ) ? $element.attr( 'data-question-length' ) : 2;
|
var group_length = $element.attr( 'data-question-length' )
|
||||||
|
? $element.attr( 'data-question-length' )
|
||||||
|
: 2;
|
||||||
|
|
||||||
index = Math.floor( index / group_length );
|
index = Math.floor( index / group_length );
|
||||||
}
|
}
|
||||||
|
@ -355,7 +360,15 @@ module.exports = Class( 'StepUi' )
|
||||||
} );
|
} );
|
||||||
|
|
||||||
// @note This is a hack. In IE8, checkbox change events don't properly fire.
|
// @note This is a hack. In IE8, checkbox change events don't properly fire.
|
||||||
this.$content.delegate('input[type="checkbox"]', 'click', function () { jQuery(this).change(); } );
|
this.$content.delegate(
|
||||||
|
'input[type="checkbox"]',
|
||||||
|
'click',
|
||||||
|
function ()
|
||||||
|
{
|
||||||
|
// XXX: remove global
|
||||||
|
jQuery( this ).change();
|
||||||
|
}
|
||||||
|
);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
||||||
|
@ -802,11 +815,15 @@ module.exports = Class( 'StepUi' )
|
||||||
*/
|
*/
|
||||||
'public getFirstInvalidField': function( cmatch )
|
'public getFirstInvalidField': function( cmatch )
|
||||||
{
|
{
|
||||||
var $element = this.$content.find( '.invalid_field[data-field-name]:visible:first' );
|
var $element = this.$content.find(
|
||||||
|
'.invalid_field[data-field-name]:visible:first'
|
||||||
|
);
|
||||||
|
|
||||||
if ( $element.length === 0 )
|
if ( $element.length === 0 )
|
||||||
{
|
{
|
||||||
$element = this.$content.find( '.invalid_field[data-field-name]:first' );
|
$element = this.$content.find(
|
||||||
|
'.invalid_field[data-field-name]:first'
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
var name = $element.attr( 'data-field-name' );
|
var name = $element.attr( 'data-field-name' );
|
||||||
|
|
Loading…
Reference in New Issue