-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
Add status
to quick edit
#64398
Add status
to quick edit
#64398
Changes from all commits
9c296ee
d62a7d4
ea00c2a
00e2f90
f0af051
c659533
a13e016
55ff29f
f234031
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
@@ -42,11 +42,36 @@ import Media from '../media'; | |||||||||||||||||||||||||||||||
// See https://github.com/WordPress/gutenberg/issues/55886 | ||||||||||||||||||||||||||||||||
// We do not support custom statutes at the moment. | ||||||||||||||||||||||||||||||||
const STATUSES = [ | ||||||||||||||||||||||||||||||||
{ value: 'draft', label: __( 'Draft' ), icon: drafts }, | ||||||||||||||||||||||||||||||||
{ value: 'future', label: __( 'Scheduled' ), icon: scheduled }, | ||||||||||||||||||||||||||||||||
{ value: 'pending', label: __( 'Pending Review' ), icon: pending }, | ||||||||||||||||||||||||||||||||
{ value: 'private', label: __( 'Private' ), icon: notAllowed }, | ||||||||||||||||||||||||||||||||
{ value: 'publish', label: __( 'Published' ), icon: published }, | ||||||||||||||||||||||||||||||||
{ | ||||||||||||||||||||||||||||||||
value: 'draft', | ||||||||||||||||||||||||||||||||
label: __( 'Draft' ), | ||||||||||||||||||||||||||||||||
icon: drafts, | ||||||||||||||||||||||||||||||||
description: __( 'Not ready to publish.' ), | ||||||||||||||||||||||||||||||||
}, | ||||||||||||||||||||||||||||||||
{ | ||||||||||||||||||||||||||||||||
value: 'future', | ||||||||||||||||||||||||||||||||
label: __( 'Scheduled' ), | ||||||||||||||||||||||||||||||||
icon: scheduled, | ||||||||||||||||||||||||||||||||
description: __( 'Publish automatically on a chosen date.' ), | ||||||||||||||||||||||||||||||||
}, | ||||||||||||||||||||||||||||||||
{ | ||||||||||||||||||||||||||||||||
value: 'pending', | ||||||||||||||||||||||||||||||||
label: __( 'Pending Review' ), | ||||||||||||||||||||||||||||||||
icon: pending, | ||||||||||||||||||||||||||||||||
description: __( 'Waiting for review before publishing.' ), | ||||||||||||||||||||||||||||||||
}, | ||||||||||||||||||||||||||||||||
{ | ||||||||||||||||||||||||||||||||
value: 'private', | ||||||||||||||||||||||||||||||||
label: __( 'Private' ), | ||||||||||||||||||||||||||||||||
icon: notAllowed, | ||||||||||||||||||||||||||||||||
description: __( 'Only visible to site admins and editors.' ), | ||||||||||||||||||||||||||||||||
}, | ||||||||||||||||||||||||||||||||
{ | ||||||||||||||||||||||||||||||||
value: 'publish', | ||||||||||||||||||||||||||||||||
label: __( 'Published' ), | ||||||||||||||||||||||||||||||||
icon: published, | ||||||||||||||||||||||||||||||||
description: __( 'Visible to everyone.' ), | ||||||||||||||||||||||||||||||||
}, | ||||||||||||||||||||||||||||||||
{ value: 'trash', label: __( 'Trash' ), icon: trash }, | ||||||||||||||||||||||||||||||||
]; | ||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||
|
@@ -258,11 +283,10 @@ function usePostFields( viewType ) { | |||||||||||||||||||||||||||||||
{ | ||||||||||||||||||||||||||||||||
label: __( 'Status' ), | ||||||||||||||||||||||||||||||||
id: 'status', | ||||||||||||||||||||||||||||||||
getValue: ( { item } ) => | ||||||||||||||||||||||||||||||||
STATUSES.find( ( { value } ) => value === item.status ) | ||||||||||||||||||||||||||||||||
?.label ?? item.status, | ||||||||||||||||||||||||||||||||
type: 'text', | ||||||||||||||||||||||||||||||||
elements: STATUSES, | ||||||||||||||||||||||||||||||||
render: PostStatusField, | ||||||||||||||||||||||||||||||||
Edit: 'radio', | ||||||||||||||||||||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. When we edit the status in the editor, we do some extra modifications See gutenberg/packages/editor/src/components/post-status/index.js Lines 150 to 164 in b12e897
I wonder how we should deal with that. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. And that's not all of it. We also show the publish date when a user selects There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
This for me is a weird interactions and I know designers feel like it's a good thing but I have some doubts about it personally :) For the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Adding or not more components to the status field can be a follow-up. Were we to do that, we could create a custom |
||||||||||||||||||||||||||||||||
enableSorting: false, | ||||||||||||||||||||||||||||||||
filterBy: { | ||||||||||||||||||||||||||||||||
operators: [ OPERATOR_IS_ANY ], | ||||||||||||||||||||||||||||||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't like this personally but I see why you did that. I wonder if this is something that is common: A way to make an "element" readonly basically. If we should absorb it into the API or not.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm ok shipping this but can we add add an inline comment to explain why we do this and that we should ideally reuse the fields untouched here (so it doesn't become a common practice).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, it seems something that should be part of the field and not check specific ids here. Definitely comment about it if we land as is..
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like the idea of "readonly" elements, but I'm not sure we should make any changes to the API just yet. What I'm seeing here is that parts of the field need to be different depending on whether it's used in the view or in the edit context. For example, the render function for date is the same: in the edit context I'd have it without the "prefix" (Modified/Scheduled/etc.).