Rename default placeholder in attribute form (#37645)
* Rename placeholder # Conflicts: # plugins/woocommerce/includes/admin/meta-boxes/views/html-product-attribute.php * Fix input `onblur` * Add changelog --------- Co-authored-by: Fernando Marichal <contacto@fernandomarichal.com>
This commit is contained in:
parent
a67b7df26f
commit
f6685b88b9
|
@ -0,0 +1,4 @@
|
|||
Significance: minor
|
||||
Type: dev
|
||||
|
||||
Rename the default placeholder in the new attribute form header to New attribute
|
|
@ -555,13 +555,19 @@ jQuery( function ( $ ) {
|
|||
} );
|
||||
|
||||
$( '.product_attributes' ).on( 'blur', 'input.attribute_name', function () {
|
||||
var text = $( this ).val();
|
||||
var attributeName = $( this )
|
||||
var $inputElement = $( this );
|
||||
var text = $inputElement.val();
|
||||
var $attribute = $inputElement
|
||||
.closest( '.woocommerce_attribute' )
|
||||
.find( 'strong.attribute_name' );
|
||||
var isPlaceholder = attributeName.hasClass( 'placeholder' );
|
||||
if ( ( isPlaceholder && text ) || ! isPlaceholder ) {
|
||||
attributeName.removeClass( 'placeholder' ).text( text );
|
||||
if ( text === '' ) {
|
||||
$attribute
|
||||
.addClass( 'placeholder' )
|
||||
.text(
|
||||
woocommerce_admin_meta_boxes.i18n_attribute_name_placeholder
|
||||
);
|
||||
} else {
|
||||
$attribute.removeClass( 'placeholder' ).text( text );
|
||||
}
|
||||
} );
|
||||
|
||||
|
|
|
@ -422,6 +422,7 @@ if ( ! class_exists( 'WC_Admin_Assets', false ) ) :
|
|||
'i18n_delete_note' => __( 'Are you sure you wish to delete this note? This action cannot be undone.', 'woocommerce' ),
|
||||
'i18n_apply_coupon' => __( 'Enter a coupon code to apply. Discounts are applied to line totals, before taxes.', 'woocommerce' ),
|
||||
'i18n_add_fee' => __( 'Enter a fixed amount or percentage to apply as a fee.', 'woocommerce' ),
|
||||
'i18n_attribute_name_placeholder' => __( 'New attribute', 'woocommerce' ),
|
||||
'i18n_product_simple_tip' => __( '<b>Simple –</b> covers the vast majority of any products you may sell. Simple products are shipped and have no options. For example, a book.', 'woocommerce' ),
|
||||
'i18n_product_grouped_tip' => __( '<b>Grouped –</b> a collection of related products that can be purchased individually and only consist of simple products. For example, a set of six drinking glasses.', 'woocommerce' ),
|
||||
'i18n_product_external_tip' => __( '<b>External or Affiliate –</b> one that you list and describe on your website but is sold elsewhere.', 'woocommerce' ),
|
||||
|
|
|
@ -8,7 +8,7 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|||
<div class="handlediv" title="<?php esc_attr_e( 'Click to toggle', 'woocommerce' ); ?>"></div>
|
||||
<div class="tips sort" data-tip="<?php esc_attr_e( 'Drag and drop to set admin attribute order', 'woocommerce' ); ?>"></div>
|
||||
<a href="#" class="remove_row delete"><?php esc_html_e( 'Remove', 'woocommerce' ); ?></a>
|
||||
<strong class="attribute_name<?php echo esc_attr( $attribute->get_name() === '' ? ' placeholder' : '' ); ?>"><?php echo esc_html( $attribute->get_name() !== '' ? wc_attribute_label( $attribute->get_name() ) : __( 'Custom attribute', 'woocommerce' ) ); ?></strong>
|
||||
<strong class="attribute_name<?php echo esc_attr( $attribute->get_name() === '' ? ' placeholder' : '' ); ?>"><?php echo esc_html( $attribute->get_name() !== '' ? wc_attribute_label( $attribute->get_name() ) : __( 'New attribute', 'woocommerce' ) ); ?></strong>
|
||||
</h3>
|
||||
<div class="woocommerce_attribute_data wc-metabox-content hidden">
|
||||
<?php require __DIR__ . '/html-product-attribute-inner.php'; ?>
|
||||
|
|
Loading…
Reference in New Issue