Skip to content
This repository has been archived by the owner on Feb 23, 2024. It is now read-only.

Commit

Permalink
Improve title for edit button (#5113)
Browse files Browse the repository at this point in the history
* Improve title for edit button #1689

Improve title for edit button

* fix edit title for Product By Attribute and All Products blocks
  • Loading branch information
gigitux authored Nov 10, 2021
1 parent 1146617 commit b5c2342
Show file tree
Hide file tree
Showing 11 changed files with 34 additions and 12 deletions.
5 changes: 4 additions & 1 deletion assets/js/blocks/featured-category/block.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
5 changes: 4 additions & 1 deletion assets/js/blocks/featured-product/block.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion assets/js/blocks/handpicked-products/block.js
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ class ProductsBlock extends Component {
{
icon: 'edit',
title: __(
'Edit',
'Edit selected products',
'woo-gutenberg-products-block'
),
onClick: () =>
Expand Down
2 changes: 1 addition & 1 deletion assets/js/blocks/product-category/block.js
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,7 @@ class ProductByCategoryBlock extends Component {
{
icon: 'edit',
title: __(
'Edit',
'Edit selected categories',
'woo-gutenberg-products-block'
),
onClick: () =>
Expand Down
2 changes: 1 addition & 1 deletion assets/js/blocks/product-tag/block.js
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,7 @@ class ProductsByTagBlock extends Component {
{
icon: 'edit',
title: __(
'Edit',
'Edit selected tags',
'woo-gutenberg-products-block'
),
onClick: () =>
Expand Down
2 changes: 1 addition & 1 deletion assets/js/blocks/products-by-attribute/block.js
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ class ProductsByAttributeBlock extends Component {
{
icon: 'edit',
title: __(
'Edit',
'Edit selected attribute',
'woo-gutenberg-products-block'
),
onClick: () =>
Expand Down
5 changes: 4 additions & 1 deletion assets/js/blocks/products/all-products/edit.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
},
Expand Down
4 changes: 2 additions & 2 deletions assets/js/blocks/reviews/edit-utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 ) => (
<BlockControls>
<ToolbarGroup
controls={ [
{
icon: 'edit',
title: __( 'Edit', 'woo-gutenberg-products-block' ),
title: buttonTitle,
onClick: () => setAttributes( { editMode: ! editMode } ),
isActive: editMode,
},
Expand Down
7 changes: 6 additions & 1 deletion assets/js/blocks/reviews/reviews-by-category/edit.js
Original file line number Diff line number Diff line change
Expand Up @@ -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() }
<EditorContainerBlock
attributes={ attributes }
Expand Down
7 changes: 6 additions & 1 deletion assets/js/blocks/reviews/reviews-by-product/edit.js
Original file line number Diff line number Diff line change
Expand Up @@ -162,9 +162,14 @@ const ReviewsByProductEditor = ( {
return renderEditMode();
}

const buttonTitle = __(
'Edit selected product',
'woo-gutenberg-products-block'
);

return (
<>
{ getBlockControls( editMode, setAttributes ) }
{ getBlockControls( editMode, setAttributes, buttonTitle ) }
{ getInspectorControls() }
<EditorContainerBlock
attributes={ attributes }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,10 @@ const EditorBlockControls = ( { isEditing, setIsEditing } ) => {
controls={ [
{
icon: 'edit',
title: __( 'Edit', 'woo-gutenberg-products-block' ),
title: __(
'Edit selected product',
'woo-gutenberg-products-block'
),
onClick: () => setIsEditing( ! isEditing ),
isActive: isEditing,
},
Expand Down

0 comments on commit b5c2342

Please sign in to comment.