-
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
Improve post locking modal #10886
Merged
Merged
Improve post locking modal #10886
Changes from 6 commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
cf4b56b
Use post type label instead of hardcoded one.
dimadin ed50979
Link to post type screen for editing all posts.
dimadin e7bd630
Use button in both cases when linking to screen with all posts.
dimadin 3b2f26f
Add translators comments about placeholder in string.
dimadin fb707bf
Add dot at the end of strings with sentences for consistency.
dimadin 9cce198
Use apostrophe instead of single-quote character.
dimadin 4c5cb60
Merge branch 'master' into fix/post-locking
gziolo File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -2,6 +2,7 @@ | |||||
* External dependencies | ||||||
*/ | ||||||
import jQuery from 'jquery'; | ||||||
import { get } from 'lodash'; | ||||||
|
||||||
/** | ||||||
* WordPress dependencies | ||||||
|
@@ -118,7 +119,7 @@ class PostLockedModal extends Component { | |||||
} | ||||||
|
||||||
render() { | ||||||
const { user, postId, isLocked, isTakeover, postLockUtils } = this.props; | ||||||
const { user, postId, isLocked, isTakeover, postLockUtils, postType } = this.props; | ||||||
if ( ! isLocked ) { | ||||||
return null; | ||||||
} | ||||||
|
@@ -133,7 +134,10 @@ class PostLockedModal extends Component { | |||||
action: 'edit', | ||||||
_wpnonce: postLockUtils.nonce, | ||||||
} ); | ||||||
const allPosts = getWPAdminURL( 'edit.php' ); | ||||||
const allPostsUrl = getWPAdminURL( 'edit.php', { | ||||||
post_type: get( postType, [ 'slug' ] ), | ||||||
} ); | ||||||
const allPostsLabel = get( postType, [ 'labels', 'all_items' ] ); | ||||||
return ( | ||||||
<Modal | ||||||
title={ isTakeover ? __( 'Someone else has taken over this post.' ) : __( 'This post is already being edited.' ) } | ||||||
|
@@ -155,38 +159,37 @@ class PostLockedModal extends Component { | |||||
<div> | ||||||
{ userDisplayName ? | ||||||
sprintf( | ||||||
/* translators: 'post' is generic and may be of any type (post, page, etc.). */ | ||||||
__( '%s now has editing control of this post. Don\'t worry, your changes up to this moment have been saved' ), | ||||||
/* translators: %s: user's display name */ | ||||||
__( '%s now has editing control of this post. Don’t worry, your changes up to this moment have been saved.' ), | ||||||
userDisplayName | ||||||
) : | ||||||
/* translators: 'post' is generic and may be of any type (post, page, etc.). */ | ||||||
__( 'Another user now has editing control of this post. Don\'t worry, your changes up to this moment have been saved' ) | ||||||
__( 'Another user now has editing control of this post. Don’t worry, your changes up to this moment have been saved.' ) | ||||||
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.
Suggested change
|
||||||
} | ||||||
</div> | ||||||
<p> | ||||||
<a href={ allPosts }> | ||||||
{ __( 'View all posts' ) } | ||||||
</a> | ||||||
</p> | ||||||
|
||||||
<div className="editor-post-locked-modal__buttons"> | ||||||
<Button isPrimary isLarge href={ allPostsUrl }> | ||||||
{ allPostsLabel } | ||||||
</Button> | ||||||
</div> | ||||||
</div> | ||||||
) } | ||||||
{ ! isTakeover && ( | ||||||
<div> | ||||||
<div> | ||||||
{ userDisplayName ? | ||||||
sprintf( | ||||||
/* translators: 'post' is generic and may be of any type (post, page, etc.). */ | ||||||
/* translators: %s: user's display name */ | ||||||
__( '%s is currently working on this post, which means you cannot make changes, unless you take over.' ), | ||||||
userDisplayName | ||||||
) : | ||||||
/* translators: 'post' is generic and may be of any type (post, page, etc.). */ | ||||||
__( 'Another user is currently working on this post, which means you cannot make changes, unless you take over.' ) | ||||||
} | ||||||
</div> | ||||||
|
||||||
<div className="editor-post-locked-modal__buttons"> | ||||||
<Button isDefault isLarge href={ allPosts }> | ||||||
{ __( 'All Posts' ) } | ||||||
<Button isDefault isLarge href={ allPostsUrl }> | ||||||
{ allPostsLabel } | ||||||
</Button> | ||||||
<PostPreviewButton /> | ||||||
<Button isPrimary isLarge href={ unlockUrl }> | ||||||
|
@@ -209,14 +212,17 @@ export default compose( | |||||
getPostLockUser, | ||||||
getCurrentPostId, | ||||||
getActivePostLock, | ||||||
getEditedPostAttribute, | ||||||
} = select( 'core/editor' ); | ||||||
const { getPostType } = select( 'core' ); | ||||||
return { | ||||||
isLocked: isPostLocked(), | ||||||
isTakeover: isPostLockTakeover(), | ||||||
user: getPostLockUser(), | ||||||
postId: getCurrentPostId(), | ||||||
postLockUtils: getEditorSettings().postLockUtils, | ||||||
activePostLock: getActivePostLock(), | ||||||
postType: getPostType( getEditedPostAttribute( 'type' ) ), | ||||||
}; | ||||||
} ), | ||||||
withDispatch( ( dispatch ) => { | ||||||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 think we want to keep the slashed single quote, the there a reason that was changed here?
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.
An apostrophe is the correct character to use in English here, not a single quote. It's certainly typographically better; that said, we should just be consistent and use one or the other everywhere. See: #7555.