-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
Site Editor: Add "Added by" description to template part navigation sidebar #48732
Site Editor: Add "Added by" description to template part navigation sidebar #48732
Conversation
Question: Do we also want to display the icon as in the template parts list view? It could help distinguish different types of authors: theme, plugin, site, or user. |
Size Change: +1.74 kB (0%) Total Size: 1.34 MB
ℹ️ View Unchanged
|
I know we won't get there for 6.2, but it would be sweet if you could reset customisations in this panel. On that note, should we still mark customised template parts somehow? The management view does this: Maybe we can add a similar suffix here? "Added by Twenty Twenty-Three (customized)".
I don't think it's essential for 6.2. We need to do a little design exploration on how best to organise things there. Icons might be the solution, but we can also try splitting the list into sections, or even having dedicated panels for each semantic area. |
I can take it for a spin!
Sure thing! Sounds good to me. |
Done in 7680c6c. |
Flaky tests detected in c7b831f. 🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/4411432295
|
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.
This is working as expected for me.
Question: Do we also want to display the icon as in the template parts list view?
Going back to this point, it might be worth adding some descriptive text based on the semantic areas. But I think we can do so in a separate issue.
7680c6c
to
00f13ee
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.
It's nice to see this tidied up, good work!
Seems like this has some overlaps with #48739. We have a few options:
Which do we want to move forward to? |
Both could be visible, but it might need a bit of design magic. ✨ |
I'll go with both for now. Welcome to do any design tweaks on this! |
Thank you, @kevin940726! I'll try to cherry-pick this for Beta 5 based on design feedback. |
It's probably fine to have both, though "This is your Footer template part" is not super useful. Maybe we concatenate?
For the description I'd rather push towards something like #48777, but suspect we don't have time. |
After a quick chat with Matias:
A revised design: The icon comes from the block category supplied by the plugin. We can fallback to the generic |
- increase space between icon / label - apply rounded corners to gravatar - colorise fallback icon
Thanks for the revisions. I don't think we need to display this detail for theme-added template parts, since that's kind of the default. It seems more important to indicate when templates are not from the theme, IE plugin or user created.
How do you mean? I don't think it matters if they're related to templates, it's more of a branding detail that can be used in multiple places. Similar to the Plugin panel in the editor: The plugin icon is fine as a fallback. I noticed a small bug, if I customise a plugin template then it switches from plugin-created to user-created: It should still be marked as a plugin template, but also marked as customized. |
The only info we get from
It should already be how it behaves in trunk in the manage template parts view though. Might be worth opening a new issue for that? |
The icon that a plugin adds for a block category might not be anything like the plugin's logo or branding. It could be a really plain 'category' icon, and it would be look like a bug to use that to represent the plugin. The block category icon was never pitched as a way for a plugin to add its branding, it just happens to be what WooCommerce does in that example. |
@kevin940726, @jameskoster, may I suggest punting this for WP 6.3? Sorry, I forgot that beta 5 already had a soft string freeze. |
Fine with me 👍 |
Thanks for clarifying. I guess we'll have to run with the default plugin icon to begin with, but we should explore a way for plugins to supply a branding element (probably icon + color), it will be important as we move into phase 3.
That's not how it behaves on trunk. Here's what I see on the template management view: |
Interesting! Looks like if you go to the manage templates view, then go back to single template view, it will show "plugin (customized)". But as soon as editing the template, it will show the author's name instead. I'm not sure what went wrong, because it's using the exact same code as in the management template view. When will |
Do you think we should fix that (separately) before merging this? The inconsistency seems a bit awkward to me. |
Yeah, I think so, cuz I'm not sure how to fix it. Unless someone can point me in a direction of a quick fix? Maybe it's still better to separate it into a different PR so that discussions don't diverge there. |
Separate PR sounds good 👍 Since this is no longer on the table for 6.2, I don't think it necessarily needs to be blocked. |
The last thing to do here is remove the "added by" detail when the template was supplied by the active theme. |
@jameskoster Not sure if I understand it correctly. I just pushed a commit to hide the "added by" detail if the template is added by a theme and the theme is the currently active theme. |
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 @kevin940726 ! I think this is working well. We can address the issue around plugin templates being marked as custom separately.
What?
Close #48483. Add "Added by" description to the template part navigation sidebar.
Why?
See #48483.
How?
In order to reuse the logic in
<AddedBy>
, I extract them into a hookuseAddedBy
, and use that in the sidebar. Open to ideas to make it more simple and more elegant!Testing Instructions
Testing Instructions for Keyboard
/wp-admin/site-editor.php?canvas=view&postType=wp_template_part&path=%2Fwp_template_part
Screenshots or screencast