Admin variations - Show link all variations bulk action

This commit is contained in:
Claudio Sanches 2015-07-10 00:49:52 -03:00
parent 3394277a86
commit 987a789367
3 changed files with 13 additions and 5 deletions

View File

@ -691,6 +691,8 @@ jQuery( function( $ ) {
var wrapper = $( '#variable_product_options .woocommerce_variations' ),
total = parseInt( wrapper.attr( 'data-total' ), 10 ),
new_qty = total + qty,
toolbar = $( '#variable_product_options .toolbar' ),
field_to_edit = $( '#field_to_edit' ),
page_nav = $( '.variations-pagenav' ),
displaying_num = $( '.displaying-num', page_nav ),
displaying_links = $( '.pagination-links', page_nav ),
@ -720,9 +722,15 @@ jQuery( function( $ ) {
// Show/hide pagenav
if ( 0 === new_qty ) {
page_nav.closest( '.toolbar' ).hide();
toolbar.not( '.toolbar-top, .toolbar-buttons' ).hide();
page_nav.hide();
$( 'option, optgroup', field_to_edit ).hide();
$( 'option', field_to_edit ).slice( 0, 2 ).show();
} else {
page_nav.closest( '.toolbar' ).show();
toolbar.show();
page_nav.show();
$( 'option, optgroup', field_to_edit ).show();
// Show/hide links
if ( 1 === total_pages ) {

File diff suppressed because one or more lines are too long

View File

@ -609,7 +609,7 @@ class WC_Meta_Box_Product_Data {
<?php else : ?>
<div class="toolbar">
<div class="toolbar toolbar-top">
<select id="field_to_edit">
<option value=""><?php _e( 'Bulk Actions', 'woocommerce' ); ?></option>
<option value="link_all_variations"><?php _e( 'Create variations from all attributes', 'woocommerce' ); ?></option>
@ -738,7 +738,7 @@ class WC_Meta_Box_Product_Data {
<div class="clear"></div>
</div>
<p class="toolbar">
<p class="toolbar toolbar-buttons">
<button type="button" class="button-primary save-variation-changes" disabled="disabled"><?php _e( 'Save Changes', 'woocommerce' ); ?></button>
<button type="button" class="button cancel-variation-changes" disabled="disabled"><?php _e( 'Cancel', 'woocommerce' ); ?></button>
<button type="button" class="button button-primary add_variation" <?php disabled( $variation_attribute_found, false ); ?>><?php _e( 'Add Variation', 'woocommerce' ); ?></button>