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

[Site Editor] Templates list screen overview #36597

Closed
26 of 38 tasks
kevin940726 opened this issue Nov 18, 2021 · 24 comments
Closed
26 of 38 tasks

[Site Editor] Templates list screen overview #36597

kevin940726 opened this issue Nov 18, 2021 · 24 comments
Assignees
Labels
[Type] Overview Comprehensive, high level view of an area of focus often with multiple tracking issues

Comments

@kevin940726
Copy link
Member

kevin940726 commented Nov 18, 2021

Based on the design in #29630 (comment), derived from TODOs in #36379. Here are the list of tasks we should do for the new Templates list screen.

👀 Needs design
🔺 Blocker for 5.9 Beta
⚠️ Blocker for 5.9 Release

🔨   Features

💅   Styles

🐛   Bugs

🧹   Enhancements and Maintenance

Accessibility ⚠️

Feel free to assign yourself to any of the above tasks if no one is working on them. Also any helps or discussions are healthy too either in the comments below or creating a separate issue referencing this.

@jameskoster
Copy link
Contributor

The screen is not responsive (⚠️ , 👀 )

Overall the screen is responsive as demonstrated in #36379 (comment). However it would be nice if the nav drawer automatically closed itself when you resize the window from desktop orientation down to mobile.

@jameskoster
Copy link
Contributor

"Styles" link in the navigation sidebar (👀 )
Making it a toggle button seems weird in a nav. What should we do about it?

Personally I am in favor of removing the styles link for now. I agree it feels very strange to actually use as implemented. We already highlight Styles in the welcome guide:

Screenshot 2021-11-18 at 18 14 49

And will no doubt surface it in any adjustments we make to the wp-admin welcome banner. Not to mention the 5.9 about page...

@kevin940726
Copy link
Member Author

Personally I am in favor of removing the styles link for now. I agree it feels very strange to actually use as implemented.

I agree. Let's remove this from the list?

@talldan
Copy link
Contributor

talldan commented Nov 19, 2021

Show recently edited user in "Added by" column

@jameskoster I had a look at adding this column for the author or user that last edited, but it looks template parts and templates don't support the author field. We will have to make some changes to the REST API code already shipped to WordPress core to support this.

A lot of templates (and I think template parts) are also shipped with the theme as files, so won't have an author. Do you think it's worth continuing to pursue adding this column?

Here's the data we get for a template from the REST API:
Screenshot 2021-11-19 at 4 10 55 pm

For template parts we might consider adding an 'Area' column, but they also generally don't seem to have a description:
Screenshot 2021-11-19 at 4 13 08 pm

Not really a lot to work with.

@talldan
Copy link
Contributor

talldan commented Nov 19, 2021

Overall the screen is responsive as demonstrated in #36379 (comment). However it would be nice if the nav drawer automatically closed itself when you resize the window from desktop orientation down to mobile.

#36638 tackles this.

@jameskoster
Copy link
Contributor

Thanks for looking in to that @talldan. The basic principle of the "added by" column was to:

  1. Clarify the original source of the template, whether that be
  • A theme.
  • A plugin.
  • A custom template created by a user at the site.
  1. In the case of templates supplied by themes and plugins, inform the user whether those templates have been customised or not.

FWIW, here's the original design:

Screenshot 2021-11-19 at 09 14 30

Would I be correct in assuming we can tell whether the template is custom, or has been customised, by the existence of that template in the db? If we cannot tell the actual author, perhaps we can just display something generic?

Seems we can use the theme in the API data for theme supplied templates. I'm not sure about plugins, but I know WooCommerce are working on adding block templates, so perhaps someone can chime in there cc @nerrad @Aljullu.

@talldan
Copy link
Contributor

talldan commented Nov 19, 2021

Would I be correct in assuming we can tell whether the template is custom, or has been customised, by the existence of that template in the db?

Yeah, I think we can use the same logic that determines whether the clear customizations UI is shown, so that should be possible 👍

I'll do some more exploration into adding author support tomorrow (edit: I mean Monday 😄 ).

Thanks for the other clarifications, that helps a lot.

@Mamaduka
Copy link
Member

Yes, we can use WP_Block_Template::$source for this column. The plugins can change this value when adding templates.

/**
* Source of the content. `theme` and `custom` is used for now.
*
* @var string
*/
public $source = 'theme';

The author support is something we can add after 5.9. I think most of the custom templates will have a single author.

@paaljoachim
Copy link
Contributor

I added feedback to the now merged PR: #36379 (comment)

Here are some of the things I noticed while giving feedback. (Let me know if this should be added else where.)
The WP black menu area is too wide and can be thinner. Site title can use truncation if needed.
< Dashboard font size is 13px and should be 14px the same as the Editor menu items.
Clicking Site or Styles should not close the left WP menu (plus it is also very slow to close). Clicking W is a fast way to open and close. W should have a shortcut.
Templates and Template Parts could contain a column for the date a specific template was created.
3 dot menu can contain a duplicate option.

@tjcafferkey
Copy link
Contributor

tjcafferkey commented Nov 19, 2021

I'm not sure about plugins, but I know WooCommerce are working on adding block templates, so perhaps someone can chime in there

@jameskoster yeah, we check the db for any templates that have been customized based on the template files we've provided. We then set the property custom as a means to identify if the template has indeed been customized.

I hope this has answered your question. Let me know if not 🙂

@jameskoster
Copy link
Contributor

@tjcafferkey I was more curious about how y'all supply the templates, and whether how the API indicates that those templates were added by WooCommerce in any way?

@paaljoachim I think most of those warrant separate issues.

@tjcafferkey
Copy link
Contributor

I was more curious about how y'all supply the templates, and whether how the API indicates that those templates were added by WooCommerce in any way?

@jameskoster We use the get_block_templates filter to add the templates from WooCommerce. We also indicate its from WooCommerce by setting woocommerce as the theme and source value here and here. Hope this helps.

@paaljoachim
Copy link
Contributor

paaljoachim commented Nov 19, 2021

I made the following issues:

[Site Editor] WP menu area - make the screen thinner and add truncation to site title.
#36657

[Site Editor] WP Menu area - Adjust < Dashboard text to 14px font.
#36658

[Site Editor] WP left menu area - Do not close menu area when selecting Site or Styles
#36659

[Site Editor] Adding a shortcut to W icon to open and close the WP left menu area.
#36660

[Site Editor] Templates and Template Parts screens - add Published date.
NEW title and focus: Templates and Template Parts screens - Provide a way for users to add a description to custom templates.
#36664

[Site Editor] Templates list screen - Add duplicate to 3 dot menu.
#36665

EDIT 27 Nov - Adding in the following issue:
Site Editor: Add New - Custom/General template
#36860

@talldan
Copy link
Contributor

talldan commented Nov 23, 2021

@jameskoster We use the get_block_templates filter to add the templates from WooCommerce. We also indicate its from WooCommerce by setting woocommerce as the theme and source value here and here. Hope this helps.

Hmm, it's a shame we didn't opt for something like source: 'plugin' to match the way source: 'theme' works. The current way makes it hard to detect whether a plugin is the source—the only option seems to be to check that the source is different to 'custom' or 'theme'. If other sources are added later this becomes brittle code.

Is the way this is defined likely to be consistent across plugins?

@kevin940726
Copy link
Member Author

@jameskoster I noticed that there's currently no way to edit a template part's name, neither in the site editor nor in the list page. Is this feature planned?

In addition, I think we also need a way to delete a template/part in the editor.

@talldan
Copy link
Contributor

talldan commented Nov 23, 2021

@kevin940726 It is possible to edit the name/title in the 'Advanced' section of the block sidebar:
Screenshot 2021-11-23 at 3 13 51 pm

@kevin940726
Copy link
Member Author

Oh I see! It's still counter-intuitive though and we should probably support that in focus mode.

@tjcafferkey
Copy link
Contributor

Hmm, it's a shame we didn't opt for something like source: 'plugin' to match the way source: 'theme' works. The current way makes it hard to detect whether a plugin is the source

@talldan I am going to look at seeing if I can make a change to update this so the source is plugin for our WooCommerce implementation, it makes much more sense.

@talldan
Copy link
Contributor

talldan commented Nov 23, 2021

Thanks @tjcafferkey, appreciate that. BTW, I have a PR as well that tries to implement showing the plugin name - #36763, I'll update that.

I'll have a think about how we can make this work consistently across plugins too, this might need some documentation.

@tjcafferkey
Copy link
Contributor

tjcafferkey commented Nov 23, 2021

I'll have a think about how we can make this work consistently across plugins too, this might need some documentation.

Yeah, that would be great @talldan. As it might be confusing, because at the moment we have the source as plugin and then the theme as woocommerce when the templates are not coming from a theme. If you'd like me to read over the documentation when you have something, I'd be more than happy to do so.

I've also opened a PR for the change described above

@jameskoster
Copy link
Contributor

we should probably support that in focus mode.

In addition to renaming, we also need a way to add descriptions (#36664). It may make sense to tackle these items together as they are closely related.

@Mamaduka
Copy link
Member

@kevin940726 I started working on server-side page context/redirection, and I think it might be better to push this enhancement post 5.9.

I will create a separate issue for tracking.

@alexstine
Copy link
Contributor

@kevin940726 My PR ##37265 should take care of this hopefully.

"Move focus to the navigation toggle button or a custom "skip to content" link when navigating"

@noisysocks
Copy link
Member

I believe we can close this now that WP 5.9 is wrapped up. Nice work again, everyone!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Type] Overview Comprehensive, high level view of an area of focus often with multiple tracking issues
Projects
None yet
Development

No branches or pull requests

8 participants