Merge pull request #18879 from woocommerce/update/category-help-text-polish
Add help text for the default category 2
This commit is contained in:
commit
b47e264cb3
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -692,6 +692,16 @@ table.wc_status_table--tools {
|
|||
}
|
||||
}
|
||||
|
||||
.taxonomy-product_cat {
|
||||
.column-thumb .woocommerce-help-tip {
|
||||
font-size: 1.5em;
|
||||
margin: 0 0 0 -34px;
|
||||
padding: 0px 2px 5px;
|
||||
display: block;
|
||||
position: absolute;
|
||||
}
|
||||
}
|
||||
|
||||
#debug-report {
|
||||
display: none;
|
||||
margin: 10px 0;
|
||||
|
|
|
@ -15,6 +15,10 @@ jQuery( function( $ ) {
|
|||
|
||||
$( table_selector ).find( '.column-handle' ).show();
|
||||
|
||||
$( document ).ajaxComplete( function() {
|
||||
$( table_selector ).find( '.column-handle' ).show();
|
||||
} );
|
||||
|
||||
$( table_selector ).sortable({
|
||||
items: item_selector,
|
||||
cursor: 'move',
|
||||
|
|
|
@ -1 +1 @@
|
|||
jQuery(function(e){var t='.column-handle input[name="term_id"]';0===e("table.wp-list-table").find(".column-handle").length&&(e("table.wp-list-table").find("tr:not(.inline-edit-row)").append('<td class="column-handle"></td>'),t=".check-column input"),e("table.wp-list-table").find(".column-handle").show(),e("table.wp-list-table").sortable({items:"tbody tr:not(.inline-edit-row)",cursor:"move",handle:".column-handle",axis:"y",forcePlaceholderSize:!0,helper:"clone",opacity:.65,placeholder:"product-cat-placeholder",scrollSensitivity:40,start:function(e,t){t.item.hasClass("alternate")||t.item.css("background-color","#ffffff"),t.item.children("td, th").css("border-bottom-width","0"),t.item.css("outline","1px solid #aaa")},stop:function(e,t){t.item.removeAttr("style"),t.item.children("td, th").css("border-bottom-width","1px")},update:function(n,i){var l,d,a=i.item.find(t).val(),o=i.item.find(".parent").html(),r=i.item.prev().find(t).val(),c=i.item.next().find(t).val();r!==undefined&&(l=i.item.prev().find(".parent").html())!==o&&(r=undefined),c!==undefined&&(d=i.item.next().find(".parent").html())!==o&&(c=undefined),r===undefined&&c===undefined||c===undefined&&d===r||c!==undefined&&l===a?e("table.wp-list-table").sortable("cancel"):(i.item.find(".check-column input").hide(),i.item.find(".check-column").append('<img alt="processing" src="images/wpspin_light.gif" class="waiting" style="margin-left: 6px;" />'),e.post(ajaxurl,{action:"woocommerce_term_ordering",id:a,nextid:c,thetaxonomy:woocommerce_term_ordering_params.taxonomy},function(e){"children"===e?window.location.reload():(i.item.find(".check-column input").show(),i.item.find(".check-column").find("img").remove())}),e("table.widefat tbody tr").each(function(){jQuery("table.widefat tbody tr").index(this)%2==0?jQuery(this).addClass("alternate"):jQuery(this).removeClass("alternate")}))}})});
|
||||
jQuery(function(e){var t="table.wp-list-table",n='.column-handle input[name="term_id"]';0===e(t).find(".column-handle").length&&(e(t).find("tr:not(.inline-edit-row)").append('<td class="column-handle"></td>'),n=".check-column input"),e(t).find(".column-handle").show(),e(document).ajaxComplete(function(){e(t).find(".column-handle").show()}),e(t).sortable({items:"tbody tr:not(.inline-edit-row)",cursor:"move",handle:".column-handle",axis:"y",forcePlaceholderSize:!0,helper:"clone",opacity:.65,placeholder:"product-cat-placeholder",scrollSensitivity:40,start:function(e,t){t.item.hasClass("alternate")||t.item.css("background-color","#ffffff"),t.item.children("td, th").css("border-bottom-width","0"),t.item.css("outline","1px solid #aaa")},stop:function(e,t){t.item.removeAttr("style"),t.item.children("td, th").css("border-bottom-width","1px")},update:function(i,d){var o,a,l=d.item.find(n).val(),c=d.item.find(".parent").html(),r=d.item.prev().find(n).val(),m=d.item.next().find(n).val();r!==undefined&&(o=d.item.prev().find(".parent").html())!==c&&(r=undefined),m!==undefined&&(a=d.item.next().find(".parent").html())!==c&&(m=undefined),r===undefined&&m===undefined||m===undefined&&a===r||m!==undefined&&o===l?e(t).sortable("cancel"):(d.item.find(".check-column input").hide(),d.item.find(".check-column").append('<img alt="processing" src="images/wpspin_light.gif" class="waiting" style="margin-left: 6px;" />'),e.post(ajaxurl,{action:"woocommerce_term_ordering",id:l,nextid:m,thetaxonomy:woocommerce_term_ordering_params.taxonomy},function(e){"children"===e?window.location.reload():(d.item.find(".check-column input").show(),d.item.find(".check-column").find("img").remove())}),e("table.widefat tbody tr").each(function(){jQuery("table.widefat tbody tr").index(this)%2==0?jQuery(this).addClass("alternate"):jQuery(this).removeClass("alternate")}))}})});
|
|
@ -134,6 +134,7 @@ jQuery( function ( $ ) {
|
|||
})
|
||||
|
||||
.on( 'init_tooltips', function() {
|
||||
|
||||
$( '.tips, .help_tip, .woocommerce-help-tip' ).tipTip( {
|
||||
'attribute': 'data-tip',
|
||||
'fadeIn': 50,
|
||||
|
@ -159,6 +160,10 @@ jQuery( function ( $ ) {
|
|||
});
|
||||
|
||||
// Tooltips
|
||||
$( document ).ajaxComplete( function() {
|
||||
$( document.body ).trigger( 'init_tooltips' );
|
||||
} );
|
||||
|
||||
$( document.body ).trigger( 'init_tooltips' );
|
||||
|
||||
// wc_input_table tables
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -38,6 +38,7 @@ class WC_Admin_Taxonomies {
|
|||
|
||||
// Taxonomy page descriptions
|
||||
add_action( 'product_cat_pre_add_form', array( $this, 'product_cat_description' ) );
|
||||
add_action( 'after-product_cat-table', array( $this, 'product_cat_notes' ) );
|
||||
|
||||
$attribute_taxonomies = wc_get_attribute_taxonomies();
|
||||
|
||||
|
@ -295,6 +296,29 @@ class WC_Admin_Taxonomies {
|
|||
echo wpautop( __( 'Product categories for your store can be managed here. To change the order of categories on the front-end you can drag and drop to sort them. To see more categories listed click the "screen options" link at the top-right of this page.', 'woocommerce' ) );
|
||||
}
|
||||
|
||||
/**
|
||||
* Add some notes to describe the behavior of the default category.
|
||||
*/
|
||||
public function product_cat_notes() {
|
||||
$category_id = get_option( 'default_product_cat', 0 );
|
||||
$category = get_term( $category_id, 'product_cat' );
|
||||
$category_name = ( ! $category || is_wp_error( $category ) ) ? _x( 'Uncategorized', 'Default category slug', 'woocommerce' ) : $category->name;
|
||||
?>
|
||||
<div class="form-wrap edit-term-notes">
|
||||
<p>
|
||||
<strong><?php _e( 'Note:', 'woocommerce' ) ?></strong><br>
|
||||
<?php
|
||||
printf(
|
||||
/* translators: %s: default category */
|
||||
__( 'Deleting a category does not delete the products in that category. Instead, products that were only assigned to the deleted category are set to the category %s.', 'woocommerce' ),
|
||||
'<strong>' . esc_html( $category_name ) . '</strong>'
|
||||
);
|
||||
?>
|
||||
</p>
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
|
||||
/**
|
||||
* Description for shipping class page to aid users.
|
||||
*/
|
||||
|
@ -335,6 +359,13 @@ class WC_Admin_Taxonomies {
|
|||
*/
|
||||
public function product_cat_column( $columns, $column, $id ) {
|
||||
if ( 'thumb' === $column ) {
|
||||
// Prepend tooltip for default category.
|
||||
$default_category_id = absint( get_option( 'default_product_cat', 0 ) );
|
||||
|
||||
if ( $default_category_id === $id ) {
|
||||
$columns .= wc_help_tip( __( 'This is the default category and it cannot be deleted. It will be automatically assigned to products with no category.', 'woocommerce' ) );
|
||||
}
|
||||
|
||||
$thumbnail_id = get_woocommerce_term_meta( $id, 'thumbnail_id', true );
|
||||
|
||||
if ( $thumbnail_id ) {
|
||||
|
|
Loading…
Reference in New Issue