Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Simplify template reset language #60256

Merged
merged 5 commits into from
Apr 3, 2024
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -326,7 +326,7 @@ export const deleteAction = {

export const resetAction = {
id: 'reset-action',
label: __( 'Clear customizations' ),
label: __( 'Reset' ),
isEligible: ( item ) => {
const isTemplatePart = item.type === TEMPLATE_PART_POST_TYPE;
const hasThemeFile = isTemplatePart && item.templatePart.has_theme_file;
Expand All @@ -338,11 +338,7 @@ export const resetAction = {
const { removeTemplate } = useDispatch( editSiteStore );
return (
<VStack spacing="5">
<Text>
{ __(
'Are you sure you want to clear these customizations?'
) }
</Text>
<Text>{ __( 'Reset and clear all customizations?' ) }</Text>
<HStack justify="right">
<Button variant="tertiary" onClick={ closeModal }>
{ __( 'Cancel' ) }
Expand All @@ -351,7 +347,7 @@ export const resetAction = {
variant="primary"
onClick={ () => removeTemplate( item ) }
>
{ __( 'Clear' ) }
{ __( 'Reset' ) }
</Button>
</HStack>
</VStack>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ import { TEMPLATE_POST_TYPE } from '../../utils/constants';

export const resetTemplateAction = {
id: 'reset-template',
label: __( 'Clear customizations' ),
label: __( 'Reset' ),
isEligible: isTemplateRevertable,
supportsBulk: true,
hideModalHeader: true,
Expand All @@ -52,12 +52,12 @@ export const resetTemplateAction = {
items.length > 1
? sprintf(
/* translators: The number of items. */
__( '%s items reverted.' ),
__( '%s items reset.' ),
items.length
)
: sprintf(
/* translators: The template/part's name. */
__( '"%s" reverted.' ),
__( '"%s" reset.' ),
decodeEntities( items[ 0 ].title.rendered )
),
{
Expand Down Expand Up @@ -96,11 +96,7 @@ export const resetTemplateAction = {
};
return (
<VStack spacing="5">
<Text>
{ __(
'Are you sure you want to clear these customizations?'
) }
</Text>
<Text>{ __( 'Reset and clear all customizations?' ) }</Text>
<HStack justify="right">
<Button variant="tertiary" onClick={ closeModal }>
{ __( 'Cancel' ) }
Expand All @@ -113,7 +109,7 @@ export const resetTemplateAction = {
closeModal();
} }
>
{ __( 'Clear' ) }
{ __( 'Reset' ) }
</Button>
</HStack>
</VStack>
Expand Down
13 changes: 5 additions & 8 deletions packages/edit-site/src/components/template-actions/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ function ResetMenuItem( { template, onClose } ) {
createSuccessNotice(
sprintf(
/* translators: The template/part's name. */
__( '"%s" reverted.' ),
__( '"%s" reset.' ),
decodeEntities( template.title.rendered )
),
{
Expand All @@ -123,11 +123,8 @@ function ResetMenuItem( { template, onClose } ) {
}
return (
<>
<MenuItem
info={ __( 'Use the template as supplied by the theme.' ) }
onClick={ () => setIsModalOpen( true ) }
>
{ __( 'Clear customizations' ) }
<MenuItem onClick={ () => setIsModalOpen( true ) }>
{ __( 'Reset' ) }
</MenuItem>
<ConfirmDialog
isOpen={ isModalOpen }
Expand All @@ -136,9 +133,9 @@ function ResetMenuItem( { template, onClose } ) {
onClose();
} }
onCancel={ () => setIsModalOpen( false ) }
confirmButtonText={ __( 'Clear' ) }
confirmButtonText={ __( 'Reset' ) }
>
{ __( 'Are you sure you want to clear these customizations?' ) }
{ __( 'Reset and clear all customizations?' ) }
</ConfirmDialog>
</>
);
Expand Down
2 changes: 1 addition & 1 deletion packages/edit-site/src/store/actions.js
Original file line number Diff line number Diff line change
Expand Up @@ -448,7 +448,7 @@ export const revertTemplate =

registry
.dispatch( noticesStore )
.createSuccessNotice( __( 'Template reverted.' ), {
.createSuccessNotice( __( 'Template reset.' ), {
type: 'snackbar',
id: noticeId,
actions: [
Expand Down
6 changes: 3 additions & 3 deletions test/e2e/specs/site-editor/template-revert.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -207,10 +207,10 @@ class TemplateRevertUtils {
await this.page.click(
'role=region[name="Editor settings"i] >> role=button[name="Actions"i]'
);
await this.page.click( 'role=menuitem[name=/Clear customizations/i]' );
await this.page.getByRole( 'button', { name: 'Clear' } ).click();
await this.page.click( 'role=menuitem[name=/Reset/i]' );
await this.page.getByRole( 'button', { name: 'Reset' } ).click();
await this.page.waitForSelector(
'role=button[name="Dismiss this notice"i] >> text=/ reverted./'
'role=button[name="Dismiss this notice"i] >> text=/ reset./'
);
}

Expand Down
Loading