From b5c2342d73879df81c0f52708cc94b373669334f Mon Sep 17 00:00:00 2001 From: Luigi Teschio Date: Wed, 10 Nov 2021 14:53:07 +0100 Subject: [PATCH] Improve title for edit button (#5113) * Improve title for edit button #1689 Improve title for edit button * fix edit title for Product By Attribute and All Products blocks --- assets/js/blocks/featured-category/block.js | 5 ++++- assets/js/blocks/featured-product/block.js | 5 ++++- assets/js/blocks/handpicked-products/block.js | 2 +- assets/js/blocks/product-category/block.js | 2 +- assets/js/blocks/product-tag/block.js | 2 +- assets/js/blocks/products-by-attribute/block.js | 2 +- assets/js/blocks/products/all-products/edit.js | 5 ++++- assets/js/blocks/reviews/edit-utils.js | 4 ++-- assets/js/blocks/reviews/reviews-by-category/edit.js | 7 ++++++- assets/js/blocks/reviews/reviews-by-product/edit.js | 7 ++++++- .../js/blocks/single-product/edit/editor-block-controls.js | 5 ++++- 11 files changed, 34 insertions(+), 12 deletions(-) diff --git a/assets/js/blocks/featured-category/block.js b/assets/js/blocks/featured-category/block.js index dce6289a7bf..1d98eb0ae23 100644 --- a/assets/js/blocks/featured-category/block.js +++ b/assets/js/blocks/featured-category/block.js @@ -111,7 +111,10 @@ const FeaturedCategory = ( { controls={ [ { icon: 'edit', - title: __( 'Edit', 'woo-gutenberg-products-block' ), + title: __( + 'Edit selected category', + 'woo-gutenberg-products-block' + ), onClick: () => setAttributes( { editMode: ! editMode } ), isActive: editMode, diff --git a/assets/js/blocks/featured-product/block.js b/assets/js/blocks/featured-product/block.js index d0ecf846389..fda297ca4df 100644 --- a/assets/js/blocks/featured-product/block.js +++ b/assets/js/blocks/featured-product/block.js @@ -161,7 +161,10 @@ const FeaturedProduct = ( { controls={ [ { icon: 'edit', - title: __( 'Edit', 'woo-gutenberg-products-block' ), + title: __( + 'Edit selected product', + 'woo-gutenberg-products-block' + ), onClick: () => setAttributes( { editMode: ! editMode } ), isActive: editMode, diff --git a/assets/js/blocks/handpicked-products/block.js b/assets/js/blocks/handpicked-products/block.js index 31751989e7b..74cd597cb78 100644 --- a/assets/js/blocks/handpicked-products/block.js +++ b/assets/js/blocks/handpicked-products/block.js @@ -170,7 +170,7 @@ class ProductsBlock extends Component { { icon: 'edit', title: __( - 'Edit', + 'Edit selected products', 'woo-gutenberg-products-block' ), onClick: () => diff --git a/assets/js/blocks/product-category/block.js b/assets/js/blocks/product-category/block.js index 1e454345b86..66f7fef63f3 100644 --- a/assets/js/blocks/product-category/block.js +++ b/assets/js/blocks/product-category/block.js @@ -291,7 +291,7 @@ class ProductByCategoryBlock extends Component { { icon: 'edit', title: __( - 'Edit', + 'Edit selected categories', 'woo-gutenberg-products-block' ), onClick: () => diff --git a/assets/js/blocks/product-tag/block.js b/assets/js/blocks/product-tag/block.js index 7e12bec0366..5d82c4879d9 100644 --- a/assets/js/blocks/product-tag/block.js +++ b/assets/js/blocks/product-tag/block.js @@ -273,7 +273,7 @@ class ProductsByTagBlock extends Component { { icon: 'edit', title: __( - 'Edit', + 'Edit selected tags', 'woo-gutenberg-products-block' ), onClick: () => diff --git a/assets/js/blocks/products-by-attribute/block.js b/assets/js/blocks/products-by-attribute/block.js index fd82c052162..62a7b472e4e 100644 --- a/assets/js/blocks/products-by-attribute/block.js +++ b/assets/js/blocks/products-by-attribute/block.js @@ -171,7 +171,7 @@ class ProductsByAttributeBlock extends Component { { icon: 'edit', title: __( - 'Edit', + 'Edit selected attribute', 'woo-gutenberg-products-block' ), onClick: () => diff --git a/assets/js/blocks/products/all-products/edit.js b/assets/js/blocks/products/all-products/edit.js index ee2aa2da365..bc84926b331 100644 --- a/assets/js/blocks/products/all-products/edit.js +++ b/assets/js/blocks/products/all-products/edit.js @@ -148,7 +148,10 @@ class Editor extends Component { controls={ [ { icon: 'edit', - title: __( 'Edit', 'woo-gutenberg-products-block' ), + title: __( + 'Edit inner product layout', + 'woo-gutenberg-products-block' + ), onClick: () => this.togglePreview(), isActive: isEditing, }, diff --git a/assets/js/blocks/reviews/edit-utils.js b/assets/js/blocks/reviews/edit-utils.js index 8be94c1e371..9ec82e7a4c6 100644 --- a/assets/js/blocks/reviews/edit-utils.js +++ b/assets/js/blocks/reviews/edit-utils.js @@ -14,13 +14,13 @@ import { BlockControls } from '@wordpress/block-editor'; import { getAdminLink, getSetting } from '@woocommerce/settings'; import ToggleButtonControl from '@woocommerce/editor-components/toggle-button-control'; -export const getBlockControls = ( editMode, setAttributes ) => ( +export const getBlockControls = ( editMode, setAttributes, buttonTitle ) => ( setAttributes( { editMode: ! editMode } ), isActive: editMode, }, diff --git a/assets/js/blocks/reviews/reviews-by-category/edit.js b/assets/js/blocks/reviews/reviews-by-category/edit.js index 6e736926999..75cc32eda51 100644 --- a/assets/js/blocks/reviews/reviews-by-category/edit.js +++ b/assets/js/blocks/reviews/reviews-by-category/edit.js @@ -139,9 +139,14 @@ const ReviewsByCategoryEditor = ( { return renderEditMode(); } + const buttonTitle = __( + 'Edit selected categories', + 'woo-gutenberg-products-block' + ); + return ( <> - { getBlockControls( editMode, setAttributes ) } + { getBlockControls( editMode, setAttributes, buttonTitle ) } { getInspectorControls() } - { getBlockControls( editMode, setAttributes ) } + { getBlockControls( editMode, setAttributes, buttonTitle ) } { getInspectorControls() } { controls={ [ { icon: 'edit', - title: __( 'Edit', 'woo-gutenberg-products-block' ), + title: __( + 'Edit selected product', + 'woo-gutenberg-products-block' + ), onClick: () => setIsEditing( ! isEditing ), isActive: isEditing, },