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 deleting posts #172

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

Comments

Projects
None yet
3 participants
@fjarrett
Copy link
Contributor

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

This comment has been minimized.

Copy link
Member

commented Jun 9, 2016

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

This comment has been minimized.

Copy link
Contributor

commented Jun 9, 2016

@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

This comment has been minimized.

Copy link
Contributor Author

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

This comment has been minimized.

Copy link
Member

commented Jun 9, 2016

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

This comment has been minimized.

Copy link
Contributor Author

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

This comment has been minimized.

Copy link
Member

commented Jun 9, 2016

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

This comment has been minimized.

Copy link
Contributor

commented Jun 9, 2016

@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

This comment has been minimized.

Copy link
Contributor

commented Jun 9, 2016

I'll have a PR shortly.

@westonruter

This comment has been minimized.

Copy link
Contributor

commented Jun 9, 2016

@fjarrett give #173 a try.

@westonruter

This comment has been minimized.

Copy link
Contributor

commented Jun 10, 2016

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

This comment has been minimized.

Copy link
Contributor Author

commented Jun 10, 2016

@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

This comment has been minimized.

Copy link
Contributor

commented Jun 10, 2016

@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 removed the wceu2016 label Jul 13, 2016

@westonruter westonruter added this to the 0.7 milestone Aug 2, 2016

@westonruter

This comment has been minimized.

Copy link
Contributor

commented Aug 2, 2016

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 referenced this issue Aug 4, 2016

Merged

Release 0.7 #210

6 of 6 tasks complete

@westonruter westonruter self-assigned this Aug 4, 2016

@westonruter

This comment has been minimized.

Copy link
Contributor

commented Aug 4, 2016

I'm picking this up now.

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.