-
Notifications
You must be signed in to change notification settings - Fork 4.6k
Template activation: improve UX for custom templates #72499
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
Conversation
|
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message. To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
|
Size Change: +121 B (+0.01%) Total Size: 2.17 MB
ℹ️ View Unchanged
|
|
Flaky tests detected in 40f6654. 🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/18657764424
|
juanfra
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the PR! I left a couple of comments.
| if ( item.is_custom ) { | ||
| // translators: Refers to a type of template: custom template | ||
| return <Badge intent="info">{ __( 'Custom' ) }</Badge>; | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As a site admin, I might not fully understand what “Custom” means when it appears next to the status. I’d associate “Custom” with a template type instead, which is also pixels away from the status, and could feel redundant.
My expectation would be to see the actual status (active or inactive) and, if the template type is custom, get some context on why I can or can’t make changes.
Maybe a padlock icon on the active/inactive status for custom templates, with a tooltip explaining the limitation, could work well here.
Also, labeling a status as “Custom” might suggest it’s something I can create or edit, which could be confusing.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the feedback, @juanfra!
My initial version had a more basic "N/A" label instead. Because custom templates really don't have a status. At least right now they don't; maybe at some point we could attempt to track them to posts that use them, but none of that is built.
padlock icon
From a design / components standpoint, I don't know if we can do this, I'd like input from designers.
with a tooltip explaining the limitation, could work well here
This makes perfect sense, I think we should. However, I'm working with @ellatrix and we'd like to merge something imperfect now and polish those interactions during the Beta cycle.
I'll quickly address the _x() part, but I hope you can approve this more or less as-is. Yay or nay on the "N/A" label?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the response, Miguel! I understand the urgency with 6.9 around the corner, so I agree that “N/A” works better than the “Custom” approach. I’m good approving this as-is, with the hope that we can revisit and refine it in the future.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Much appreciated! :)
| record.is_custom || | ||
| ( ! record.meta?.is_wp_suggestion && | ||
| ! defaultTemplateTypes.find( | ||
| ( type ) => type.slug === record.slug | ||
| ) ), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Adapted from
gutenberg/packages/editor/src/components/post-template/hooks.js
Lines 95 to 102 in c1f90a6
| // Only give "custom" templates as an option, which | |
| // means the is_wp_suggestion meta field is not set and | |
| // the slug is not found in the default template types. | |
| // https://github.com/WordPress/wordpress-develop/blob/97382397b2bd7c85aef6d4cd1c10bafd397957fc/src/wp-includes/block-template-utils.php#L858-L867 | |
| ! template.meta.is_wp_suggestion && | |
| ! defaultTemplateTypes.find( | |
| ( type ) => type.slug === template.slug | |
| ) |
ellatrix
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Works, tested both created and registered templates.
dde4c04 to
86181d3
Compare
- Avoid "Custom" label for template status - Add a tentative "title" attribute to the status badge for custom templates - Use _x() where appropriate
We'll want to expose this via REST API, most likely.
86181d3 to
987422f
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The failing tests are unrelated to this PR and started failing in trunk earlier today, seemingly after #72487. Let's merge this without those tests passing to get ready for Beta1.
|
Yes These are failing on trunk too and we need this PR to get merged and included in a package asap. Let's merge. I will skip the performance test too. |
Co-authored-by: mcsf <[email protected]> Co-authored-by: juanfra <[email protected]> Co-authored-by: ellatrix <[email protected]> Co-authored-by: priethor < [email protected]>
|
I just cherry-picked this PR to the wp/latest branch to get it included in the next release: 116f67e |
Co-authored-by: mcsf <[email protected]> Co-authored-by: juanfra <[email protected]> Co-authored-by: ellatrix <[email protected]> Co-authored-by: priethor < [email protected]>
|
I just cherry-picked this PR to the release/21.9 branch to get it included in the next release: a608ced |
| <Badge | ||
| intent="info" | ||
| title={ __( | ||
| 'Custom templates cannot be active nor inactive.' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Worth double-checking, but I think this is grammatically wrong, and it should be this instead:
Custom templates cannot be active or inactive.
What?
Follow-up of #67125
In the template editor:
Why?
Custom templates aren't part of the template hierarchy and thus aren't subject to activation. The actions available and UI should reflect this.
Questions
intent="info"to set custom templates apart from deactivated templates. What do you think of this? Happy to remove it and let the default take over.Screenshots or screencast