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

Improve UX for trashing posts #211

Merged
merged 20 commits into from Aug 6, 2016

Conversation

Projects
None yet
3 participants
@westonruter
Copy link
Contributor

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

This comment has been minimized.

Copy link
Contributor Author

commented Aug 4, 2016

@lgedeon could you test please?

@fjarrett also, could you review?

@fjarrett

This comment has been minimized.

Copy link
Contributor

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

This comment has been minimized.

Copy link
Contributor Author

commented Aug 4, 2016

@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.

@fjarrett

This comment has been minimized.

Copy link
Contributor

commented Aug 4, 2016

@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

This comment has been minimized.

Copy link
Contributor Author

commented Aug 4, 2016

@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?

@fjarrett

This comment has been minimized.

Copy link
Contributor

commented Aug 4, 2016

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

@lgedeon

This comment has been minimized.

Copy link
Contributor

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

This comment has been minimized.

Copy link
Contributor

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

This comment has been minimized.

Copy link
Contributor Author

commented Aug 5, 2016

@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

This comment has been minimized.

Copy link
Contributor Author

commented Aug 5, 2016

@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 added some commits Aug 5, 2016

@westonruter

This comment has been minimized.

Copy link
Contributor Author

commented Aug 5, 2016

@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

This comment has been minimized.

Copy link
Contributor Author

commented Aug 5, 2016

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

@westonruter

This comment has been minimized.

Copy link
Contributor Author

commented Aug 5, 2016

@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

This comment has been minimized.

Copy link
Contributor

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

This comment has been minimized.

Copy link
Contributor

commented Aug 5, 2016

Looks good! 👍

@fjarrett

This comment has been minimized.

Copy link
Contributor

commented Aug 5, 2016

@westonruter Wonderful. Works great for me.

@westonruter

This comment has been minimized.

Copy link
Contributor Author

commented Aug 5, 2016

Thanks for testing!!

  • Add unit tests.

@westonruter westonruter merged commit 1668041 into develop Aug 6, 2016

3 checks passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details
continuous-integration/travis-ci/push The Travis CI build passed
Details
coverage/coveralls First build on develop at 96.481%
Details

@westonruter westonruter deleted the feature/issue-172-trashing-posts branch Aug 6, 2016

@westonruter westonruter modified the milestone: 0.7 Aug 6, 2016

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.