Merge pull request #18706 from woocommerce/update/uncategorized

Uncategorized tweaks
This commit is contained in:
Claudiu Lodromanean 2018-01-31 08:16:51 -08:00 committed by GitHub
commit c28e2e2de5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 19 additions and 9 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -2440,7 +2440,8 @@ table.wp-list-table {
white-space: nowrap;
}
.column-handle {
.column-handle,
.column-nosort {
width: 17px;
}

View File

@ -3,12 +3,19 @@
/* Modifided script from the simple-page-ordering plugin */
jQuery( function( $ ) {
$( 'table.widefat.wp-list-table tr' ).append(
'<td class="column-handle"></td>'
);
var table_selector = 'table.wp-list-table',
item_selector = 'tbody tr:not(.inline-edit-row, ' + '#tag-' + woocommerce_term_ordering_params.default + ')';
$( 'table.widefat.wp-list-table' ).sortable({
items: 'tbody tr:not(.inline-edit-row)',
$( 'table.wp-list-table tr:not(.inline-edit-row)' ).each( function() {
if ( 'tag-' + woocommerce_term_ordering_params.default === $( this ).prop( 'id' ) ) {
$( this ).append( '<td class="column-nosort"></td>' );
} else {
$( this ).append( '<td class="column-handle"></td>' );
}
} );
$( table_selector ).sortable({
items: item_selector,
cursor: 'move',
handle: '.column-handle',
axis: 'y',
@ -53,7 +60,7 @@ jQuery( function( $ ) {
// If previous and next not at same tree level, or next not at same tree level and the previous is the parent of the next, or just moved item beneath its own children
if ( ( prevtermid === undefined && nexttermid === undefined ) || ( nexttermid === undefined && nexttermparent === prevtermid ) || ( nexttermid !== undefined && prevtermparent === termid ) ) {
$( 'table.widefat.wp-list-table' ).sortable( 'cancel' );
$( table_selector ).sortable( 'cancel' );
return;
}

View File

@ -328,6 +328,7 @@ class WC_Admin_Assets {
$woocommerce_term_order_params = array(
'taxonomy' => $taxonomy,
'default' => absint( get_option( 'default_product_cat' ) ),
);
wp_localize_script( 'woocommerce_term_ordering', 'woocommerce_term_ordering_params', $woocommerce_term_order_params );

View File

@ -1854,6 +1854,7 @@ if ( ! function_exists( 'woocommerce_get_product_subcategories' ) ) {
'hierarchical' => 1,
'taxonomy' => 'product_cat',
'pad_counts' => 1,
'exclude' => get_option( 'default_product_cat' ),
) ) );
wp_cache_set( 'product-categories-' . $parent_id, $product_categories, 'product_cat' );
}