Skip to content

Commit

Permalink
improved the admin.js
Browse files Browse the repository at this point in the history
  • Loading branch information
claudiosanches committed Oct 12, 2014
1 parent d943e9f commit b426e32
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 12 deletions.
16 changes: 5 additions & 11 deletions assets/js/admin.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,16 @@
'use strict';

$( function () {
$( '#woocommerce_pagarme_methods' ).on( 'change', function () {
var current = $( this ).val(),
elements = $( '#mainform h4:eq(0), #mainform table:eq(1)' );

function switchInstallmentsOptions( target ) {
var elements = $( '#mainform h4:eq(0), #mainform table:eq(1)' );

if ( 'ticket' === target ) {
if ( 'ticket' === current ) {
elements.hide();
} else {
elements.show();
}
}

switchInstallmentsOptions( $( '#woocommerce_pagarme_methods' ).val() );

$( '#woocommerce_pagarme_methods' ).on( 'change', function () {
switchInstallmentsOptions( $( this ).val() );
});
}).change();
});

}( jQuery ));
2 changes: 1 addition & 1 deletion assets/js/admin.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit b426e32

Please sign in to comment.