Fixed tooltips load for variations

This commit is contained in:
Claudio Sanches 2015-07-08 15:05:52 -03:00
parent c0ca144d57
commit 4aae7b99be
3 changed files with 40 additions and 17 deletions

View File

@ -57,7 +57,10 @@ jQuery( function( $ ) {
* Run actions when variations is loaded
*/
variations_loaded: function() {
// Show/hide downloadable, virtual and stock fields
$( 'input.variable_is_downloadable, input.variable_is_virtual, input.variable_manage_stock', $( this ) ).change();
// Open sale schedule fields when have some sale price date
$( '.woocommerce_variation', $( this ) ).each( function( index, el ) {
var $el = $( el ),
date_from = $( '.sale_price_dates_from', $el ).val(),
@ -67,8 +70,22 @@ jQuery( function( $ ) {
$( 'a.sale_schedule', $el ).click();
}
});
// Remove variation-needs-update classes
$( '.woocommerce_variations .variation-needs-update', $( this ) ).removeClass( 'variation-needs-update' );
// Disable save button
$( 'button.save-variation-changes', $( this ) ).attr( 'disabled', 'disabled' );
// Init TipTip
$( '#tiptip_holder' ).removeAttr( 'style' );
$( '#tiptip_arrow' ).removeAttr( 'style' );
$( '.woocommerce_variations .tips' ).tipTip({
'attribute': 'data-tip',
'fadeIn': 50,
'fadeOut': 50,
'delay': 200
});
}
};

File diff suppressed because one or more lines are too long

View File

@ -19,14 +19,14 @@ jQuery( function( $ ) {
});
// Prevent enter submitting post form
$( '#upsell_product_data' ).bind( 'keypress', function(e) {
$( '#upsell_product_data' ).bind( 'keypress', function( e ) {
if ( e.keyCode === 13 ) {
return false;
}
});
// Type box
$('.type_box').appendTo( '#woocommerce-product-data h3.hndle span' );
$( '.type_box' ).appendTo( '#woocommerce-product-data h3.hndle span' );
$( function() {
// Prevent inputs in meta box headings opening/closing contents
@ -51,8 +51,8 @@ jQuery( function( $ ) {
}
return false;
});
$('#catalog-visibility .save-post-visibility').click(function () {
$('#catalog-visibility-select').slideUp('fast');
$('#catalog-visibility .save-post-visibility').click( function () {
$('#catalog-visibility-select').slideUp( 'fast' );
$('#catalog-visibility .edit-catalog-visibility').show();
var label = $( 'input[name=_visibility]:checked' ).attr( 'data-label' );
@ -75,9 +75,9 @@ jQuery( function( $ ) {
$( 'input[name=_visibility]' ).removeAttr( 'checked' );
$( 'input[name=_visibility][value=' + current_visibility + ']' ).attr( 'checked', 'checked' );
var label = $('input[name=_visibility]:checked').attr('data-label');
var label = $( 'input[name=_visibility]:checked' ).attr( 'data-label' );
if ( current_featured === 'yes' ) {
if ( 'yes' === current_featured ) {
label = label + ', ' + woocommerce_admin_meta_boxes.featured_label;
$( 'input[name=_featured]' ).attr( 'checked', 'checked' );
} else {
@ -108,7 +108,7 @@ jQuery( function( $ ) {
show_and_hide_panels();
$( 'ul.wc-tabs li:visible' ).eq(0).find( 'a' ).click();
$( 'ul.wc-tabs li:visible' ).eq( 0 ).find( 'a' ).click();
$( document.body ).trigger( 'woocommerce-product-type-change', select_val, $( this ) );
@ -195,9 +195,9 @@ jQuery( function( $ ) {
return false;
});
$( '#woocommerce-product-data' ).on( 'click', '.cancel_sale_schedule', function() {
var $wrap = $(this).closest( 'div, table' );
var $wrap = $( this ).closest( 'div, table' );
$(this).hide();
$( this ).hide();
$wrap.find( '.sale_schedule' ).show();
$wrap.find( '.sale_price_dates_fields' ).hide();
$wrap.find( '.sale_price_dates_fields' ).find( 'input' ).val('');
@ -273,13 +273,19 @@ jQuery( function( $ ) {
var $wrapper = $( this ).closest( '#product_attributes' ).find( '.product_attributes' );
var product_type = $( 'select#product-type' ).val();
var data = {
action : 'woocommerce_add_attribute',
taxonomy : attribute,
i : size,
security : woocommerce_admin_meta_boxes.add_attribute_nonce
action: 'woocommerce_add_attribute',
taxonomy: attribute,
i: size,
security: woocommerce_admin_meta_boxes.add_attribute_nonce
};
$wrapper.block({ message: null, overlayCSS: { background: '#fff', opacity: 0.6 } });
$wrapper.block({
message: null,
overlayCSS: {
background: '#fff',
opacity: 0.6
}
});
$.post( woocommerce_admin_meta_boxes.ajax_url, data, function( response ) {
$wrapper.append( response );
@ -303,7 +309,7 @@ jQuery( function( $ ) {
return false;
});
$( '.product_attributes' ).on('blur', 'input.attribute_name', function() {
$( '.product_attributes' ).on( 'blur', 'input.attribute_name', function() {
$( this ).closest( '.woocommerce_attribute' ).find( 'strong.attribute_name' ).text( $( this ).val() );
});
@ -551,7 +557,7 @@ jQuery( function( $ ) {
var attachment_ids = attachment_ids ? attachment_ids + ',' + attachment.id : attachment.id;
var attachment_image = attachment.sizes.thumbnail ? attachment.sizes.thumbnail.url : attachment.url;
$product_images.append('<li class="image" data-attachment_id="' + attachment.id + '"><img src="' + attachment_image + '" /><ul class="actions"><li><a href="#" class="delete" title="' + $el.data('delete') + '">' + $el.data('text') + '</a></li></ul></li>');
$product_images.append( '<li class="image" data-attachment_id="' + attachment.id + '"><img src="' + attachment_image + '" /><ul class="actions"><li><a href="#" class="delete" title="' + $el.data('delete') + '">' + $el.data('text') + '</a></li></ul></li>' );
}
});