Skip to content

Commit

Permalink
Template parts: set backpath to patterns page (#60667)
Browse files Browse the repository at this point in the history
Co-authored-by: oandregal <oandregal@git.wordpress.org>
Co-authored-by: mcsf <mcsf@git.wordpress.org>
Co-authored-by: jameskoster <jameskoster@git.wordpress.org>
  • Loading branch information
4 people authored Apr 11, 2024
1 parent c86e77f commit 05926aa
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 16 deletions.
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 @@ -98,11 +97,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

0 comments on commit 05926aa

Please sign in to comment.