Skip to content
This repository has been archived by the owner on Dec 16, 2022. It is now read-only.

Improve UX for trashing posts #211

Merged
merged 20 commits into from
Aug 6, 2016
Merged

Conversation

westonruter
Copy link
Contributor

@westonruter westonruter commented Aug 4, 2016

  • Adds custom control template for post status control
  • Introduces “Move to Trash” link that appears next to dropdown which appears when the status is not trash.
  • Clicking the “Move to Trash” link sets the setting's post_status property to trash and then collapses the post section, to add a similar experience to clicking this same link on the edit post admin screen where clicking the link moves the user to the post list table. The collapse is done after a half-second delay to show the user that clicking the link just changes the dropdown, giving them a clue to restore the post by changing the status back to something other than trash.
  • The post can be untrashed simply by re-expanding the section and changing the status to a non-trash status.

screen shot 2016-08-04 at 1 26 32 pm

screen shot 2016-08-04 at 1 26 46 pm

Fixes #172.

@westonruter
Copy link
Contributor Author

@lgedeon could you test please?

@fjarrett also, could you review?

@frankiejarrett
Copy link
Contributor

frankiejarrett commented Aug 4, 2016

@westonruter I don't see any DB write on trashed posts now. However, in my testing I deleted all posts/pages and created my very first page with the Customizer, then deleted it and Saved but a (no title) item kept reappearing in the list. Here's a video: https://youtu.be/pcnJTyUyd8U

@westonruter
Copy link
Contributor Author

@fjarrett thanks very much for that video!

Also, it looks like there is a problem with your Select2 dropdown, that the styles haven't been enqueued.

@frankiejarrett
Copy link
Contributor

@westonruter Running WP 4.7-alpha-38196 no plugins installed except Customize Posts, and Twenty Sixteen. Could it be because I have no posts in the database?

@westonruter
Copy link
Contributor Author

@fjarrett I don't see how. In the source, do you see a reference to select2.css or select2.min.css being enqueued and printed out? Are they 404'ing?

@frankiejarrett
Copy link
Contributor

frankiejarrett commented Aug 4, 2016

@westonruter Nothing in the console and nothing in the source.

@lgedeon
Copy link
Contributor

lgedeon commented Aug 4, 2016

@westonruter I was able to delete, and then go back and restore a post by changing the status. Looks solid. Have you considered a (restore) link in place where the (move to trash) link was?

Also after deleting and going away or refreshing, I don't see a way to restore without going to the old wp-admin interface.

@lgedeon
Copy link
Contributor

lgedeon commented Aug 4, 2016

One other observation, changing to trash manually doesn't collapse the section like it does if you click the link. I am not sure if it needs to be consistent, just noticing.

@westonruter
Copy link
Contributor Author

@lgedeon

Have you considered a (restore) link in place where the (move to trash) link was?

It did come to mind. But I figured for now it was just as easy to have them change status back to something else, rather than keep track of what the previous pre-trash status was (which is easy, but nonetheless). Maybe we should consider that for a future enhancement.

Also after deleting and going away or refreshing, I don't see a way to restore without going to the old wp-admin interface.

That's true. I suppose we could address that by allowing trashed posts to appear in the Select2 dropdown results. That would be simple to do.

One other observation, changing to trash manually doesn't collapse the section like it does if you click the link. I am not sure if it needs to be consistent, just noticing.

Yes, this was intentional.

@westonruter
Copy link
Contributor Author

@lgedeon:

Also after deleting and going away or refreshing, I don't see a way to restore without going to the old wp-admin interface.

This has been addressed in 915a306, 1deeeb9, and 4f5cb05. You can now access trashed posts in the Select2 dropdown. Selecting one of these trashed posts causes it to be loaded with the pre-trashed status and slug supplied and this new setting marked dirty from the start.

@westonruter
Copy link
Contributor Author

@lgedeon

It did come to mind. But I figured for now it was just as easy to have them change status back to something else, rather than keep track of what the previous pre-trash status was (which is easy, but nonetheless). Maybe we should consider that for a future enhancement.

This is added in 5bbe6d2:

screen shot 2016-08-05 at 12 52 00 am

I'm not totally sure it is really useful.

@westonruter
Copy link
Contributor Author

@fjarrett the issue with the broken Select2 style should be fixed in 58b33f4.

@westonruter
Copy link
Contributor Author

@fjarrett

I don't see any DB write on trashed posts now. However, in my testing I deleted all posts/pages and created my very first page with the Customizer, then deleted it and Saved but a (no title) item kept reappearing in the list. Here's a video: https://youtu.be/pcnJTyUyd8U

This issue should be fixed in 9852605

@lgedeon
Copy link
Contributor

lgedeon commented Aug 5, 2016

I'm not totally sure it is really useful.

Agreed. My first thought was feature parity. I don't want to ever give anyone an excuse to exit the customizer.
That said, kids, pets, pizza sauce, accidents happen, and during that moment of panic after accidentally deleting an important post an easy obvious solution might really be appreciated.
Thank you for adding it.

@lgedeon
Copy link
Contributor

lgedeon commented Aug 5, 2016

Looks good! 👍

@frankiejarrett
Copy link
Contributor

@westonruter Wonderful. Works great for me.

@westonruter
Copy link
Contributor Author

westonruter commented Aug 5, 2016

Thanks for testing!!

  • Add unit tests.

@westonruter westonruter merged commit 1668041 into develop Aug 6, 2016
@westonruter westonruter deleted the feature/issue-172-trashing-posts branch August 6, 2016 01:37
@westonruter westonruter modified the milestone: 0.7 Aug 6, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants