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

Improve UX for deleting posts #172

Closed
fjarrett opened this issue Jun 9, 2016 · 14 comments
Closed

Improve UX for deleting posts #172

fjarrett opened this issue Jun 9, 2016 · 14 comments
Assignees
Milestone

Comments

@fjarrett
Copy link
Contributor

fjarrett commented Jun 9, 2016

Thanks to #48 the user can now create new posts and pages. But what if they want to then discard a newly drafted post/page?

With the current implementation, in order to "undo" a newly created post/page the user must leave the Customizer and discard all other changes that they might have staged in the session.

Additionally, it seems reasonable that the user should be able to trash posts/pages that are pre-existing, just as they can inside post.php.

delete-trash-content

@valendesigns
Copy link
Contributor

The way that works is to set the post status to trash which will clean up any newly created or existing posts when the state is saved.

@westonruter
Copy link
Contributor

@fjarrett:

But what if they want to then discard a newly drafted post/page?

Just change the Post Status to Trash?

With the current implementation, in order to "undo" a newly created post/page the user must leave the Customizer and discard all other changes that they might have staged in the session.

Actually no, they just have to change the Post Status to Trash.

Additionally, it seems reasonable that the user should be able to trash posts/pages that are pre-existing, just as they can inside post.php.

Yeah, this can be done by changing the Post Status to Trash:

trash

I think the confusion here may be that users don't expect “Trash” to be among the status dropdown. Maybe there should be a shortcut link like “Move to trash” that would select this status for them?

@fjarrett
Copy link
Contributor Author

fjarrett commented Jun 9, 2016

@valendesigns OK got it. Though not very intuitive or consistent from a UI perspective. I couldn't find it :-)

screen shot 2016-06-09 at 5 41 20 pm

@valendesigns
Copy link
Contributor

It's not consistent but we can add the trash link to fix that which would select trash in the post status for now. We'll do more work on that control in the future. We still need to sync back to the admin and this would be a good time to address the big picture concerns.

@fjarrett
Copy link
Contributor Author

fjarrett commented Jun 9, 2016

Cool, thanks for the feedback.

I just tested selecting the "Trash" post status on a newly-created page and clicking Save & Publish and it actually puts the page in the Trash. Which means it's still creating a post in the database.

So when a user clicks "Add New Post" they only have two options to back out:

A. Have the post written to their database as a "Trash" post.
B. Exit the Customizer and lose all other changes.

There is no way to completely discard it without a database write as far as I can see in my testing.

@valendesigns
Copy link
Contributor

The post is technically in the DB already, because it's created as a auto-draft. I agree it's not ideal and we'll need to address as much as we can but for a first version we have landed here. Definitely need discuss how it will be handled in future iterations and mimic wp-admin as much as we can. The issue is that we need to duplicate a lot of JS to make it the same and we didn't have time for that.

@westonruter
Copy link
Contributor

@fjarrett

There is no way to completely discard it without a database write as far as I can see in my testing.

Good find! So I think the solution here is simple: we can just modify the WP_Customize_Post_Setting::update() method to do a no-op if the new status us trash and the underlying post has a post_status of auto-draft. We'd skip calling wp_trash_post() in this case.

@westonruter
Copy link
Contributor

I'll have a PR shortly.

@westonruter
Copy link
Contributor

@fjarrett give #173 a try.

@westonruter
Copy link
Contributor

I also started a WIP branch for adding a Move to Trash link: bugfix/delete-trashed-auto-drafts...feature/trash-link

We'd need to keep track of whether or not the post was saved yet, and of not, show a Delete link instead. And then if the post is moved to the trash, then should there be a Restore link to change the status back from Trash to Draft or something?

@fjarrett
Copy link
Contributor Author

@westonruter Nice! Well, my initial reaction/thought about this was:

The shortcut link doesn't really solve much other than lessening the obscurity of the Trash option in a collapsed dropdown. The user clicks the link, then what? They are likely going to click the back button to view the post list. So why not just do this in one click?

  1. Remove the "Trash" option from the dropdown (no other place in core has this anyway).
  2. Show a red "Move to Trash" link somewhere (like the original mock I posted).
  3. When clicked, the status is forced to trash and you are taken immediately to the list view (which already does a nice job of indicating that a post is Trashed).

screen shot 2016-06-09 at 10 04 40 pm

Regarding how to handle editing a post that's currently trashed, this one seems tricky to me. I know that in the WP Admin you can't even edit a trashed post until it's been restored.

screen shot 2016-06-09 at 10 48 35 pm

So should the Customizer behave the same way? I'm not really sure, but I do have a mock 😄

screen shot 2016-06-09 at 10 49 36 pm

@westonruter
Copy link
Contributor

@fjarrett your mock of having controls disabled is similar to what @valendesigns had initially (see acb3aef), aside from the Restore button. The problem we had was disabling the fields in the controls is not immediately straightforward, since there is no control.disable() method (yet). I mean, we could just opacity:0.5 all of the controls but still allow them to be interacted with?

We'd also need to develop a custom control for Post Status since right now it is using a standard select field that has the post statuses as choices. Definitely doable.

@westonruter westonruter changed the title Allow newly created posts and pages to be deleted Improve UX for deleting posts Jun 10, 2016
@westonruter westonruter added this to the 0.7 milestone Aug 2, 2016
@westonruter
Copy link
Contributor

I think we can leave the Trashed status in the dropdown, but we can just add a link which will update the status to trash and then collapse the section. This will be easy to do and will allow a post to be restored from trash if desired before saving.

@westonruter westonruter mentioned this issue Aug 4, 2016
6 tasks
@westonruter westonruter self-assigned this Aug 4, 2016
@westonruter
Copy link
Contributor

I'm picking this up now.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants