Skip to content

Commit

Permalink
Site Editor: Update hrefs to not specifically refer to themes.php?pag…
Browse files Browse the repository at this point in the history
…e=gutenberg-edit-site. (#36705)

This allows the JavaScript to work in Core where the URL will be site-editor.php.
  • Loading branch information
noisysocks committed Nov 23, 2021
1 parent ea0a16c commit 0fc1c60
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,7 @@ export default function NewTemplatePart( { postType } ) {
} );

// Navigate to the created template part editor.
window.location.search = addQueryArgs( '', {
page: 'gutenberg-edit-site',
window.location.href = addQueryArgs( window.location.href, {
postId: templatePart.id,
postType: 'wp_template_part',
} );
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,7 @@ export default function NewTemplate( { postType } ) {
} );

// Navigate to the created template editor.
window.location.search = addQueryArgs( '', {
page: 'gutenberg-edit-site',
window.location.href = addQueryArgs( window.location.href, {
postId: template.id,
postType: 'wp_template',
} );
Expand Down
3 changes: 1 addition & 2 deletions packages/edit-site/src/components/list/table.js
Original file line number Diff line number Diff line change
Expand Up @@ -109,8 +109,7 @@ export default function Table( { templateType } ) {
>
<td className="edit-site-list-table-column" role="cell">
<a
href={ addQueryArgs( '', {
page: 'gutenberg-edit-site',
href={ addQueryArgs( window.location.href, {
postId: template.id,
postType: template.type,
} ) }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,23 +82,24 @@ const NavigationPanel = ( { isOpen, setIsOpen, activeTemplateType } ) => {
<NavigationGroup title={ __( 'Editor' ) }>
<NavigationItem
title={ __( 'Site' ) }
href={ addQueryArgs( '', {
page: 'gutenberg-edit-site',
href={ addQueryArgs( window.location.href, {
postId: undefined,
postType: undefined,
} ) }
/>
<NavigationItem
title={ __( 'Templates' ) }
item="wp_template"
href={ addQueryArgs( '', {
page: 'gutenberg-edit-site',
href={ addQueryArgs( window.location.href, {
postId: undefined,
postType: 'wp_template',
} ) }
/>
<NavigationItem
title={ __( 'Template Parts' ) }
item="wp_template_part"
href={ addQueryArgs( '', {
page: 'gutenberg-edit-site',
href={ addQueryArgs( window.location.href, {
postId: undefined,
postType: 'wp_template_part',
} ) }
/>
Expand Down
4 changes: 2 additions & 2 deletions packages/edit-site/src/components/template-details/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -90,9 +90,9 @@ export default function TemplateDetails( { template, onClose } ) {

<Button
className="edit-site-template-details__show-all-button"
href={ addQueryArgs( '', {
page: 'gutenberg-edit-site',
href={ addQueryArgs( window.location.href, {
// TODO: We should update this to filter by template part's areas as well.
postId: undefined,
postType: template.type,
} ) }
>
Expand Down

0 comments on commit 0fc1c60

Please sign in to comment.