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

Template parts: set backpath to patterns page #60667

Merged
merged 7 commits into from
Apr 11, 2024
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ import AddNewTemplate from '../add-new-template';
import { useAddedBy } from './hooks';
import {
TEMPLATE_POST_TYPE,
TEMPLATE_PART_POST_TYPE,
ENUMERATION_TYPE,
OPERATOR_IS_ANY,
LAYOUT_GRID,
Expand Down Expand Up @@ -102,11 +101,6 @@ function Title( { item, viewType } ) {
canvas: 'edit',
},
};
if ( item.type === TEMPLATE_PART_POST_TYPE ) {
linkProps.state = {
backPath: '/wp_template_part/all',
};
}
return (
<Link { ...linkProps }>
{ decodeEntities( item.title?.rendered ) || __( '(no title)' ) }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ function TemplatesList( { availableTemplates, onSelect } ) {

const POST_TYPE_PATH = {
wp_template: '/wp_template',
wp_template_part: '/wp_template_part/all',
wp_template_part: '/patterns',
};

export default function TemplatePanel() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,11 +93,6 @@ function useTemplateDetails( postType, postId ) {
return { title, description, content, footer };
}

const POST_TYPE_PATH = {
wp_template: '/wp_template',
wp_template_part: '/wp_template_part/all',
};

export default function SidebarNavigationScreenTemplate() {
const navigator = useNavigator();
const {
Expand All @@ -119,7 +114,7 @@ export default function SidebarNavigationScreenTemplate() {
postId={ postId }
toggleProps={ { as: SidebarButton } }
onRemove={ () => {
navigator.goTo( POST_TYPE_PATH[ postType ] );
navigator.goTo( '/' + postType );
} }
/>
<SidebarButton
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -154,9 +154,7 @@ function useManipulateDocumentCommands() {
decodeEntities( template.title )
);
const path =
template.type === TEMPLATE_POST_TYPE
? '/wp_template'
: '/wp_template_part/all';
template.type === TEMPLATE_POST_TYPE ? '/wp_template' : '/patterns';
commands.push( {
name: 'core/remove-template',
label,
Expand Down
Loading