-
Notifications
You must be signed in to change notification settings - Fork 156
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #122 from 10up/feature/gutenberg-sidebar-status-av…
…ailability-panel Add Gutenberg sidebar status availability panel
- Loading branch information
Showing
28 changed files
with
10,063 additions
and
2,264 deletions.
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 |
---|---|---|
@@ -1,3 +1,3 @@ | ||
{ | ||
"presets" : ["env"] | ||
"presets" : ["env", "react"] | ||
} |
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
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 |
---|---|---|
@@ -0,0 +1,54 @@ | ||
body.dt-linked-post { | ||
|
||
& .edit-post-visual-editor, | ||
& .editor-post-excerpt__textarea { | ||
opacity: .5; | ||
pointer-events: none; | ||
cursor: default; | ||
} | ||
|
||
& input, | ||
& select, | ||
& button, | ||
& textarea, | ||
& .button { | ||
opacity: .5; | ||
pointer-events: none; | ||
cursor: default; | ||
} | ||
|
||
& .edit-post-header__settings, | ||
& .components-time-picker, | ||
& .react-datepicker, | ||
& .components-panel__header { | ||
& input, | ||
& select, | ||
& button, | ||
& textarea, | ||
& .button { | ||
opacity: 1; | ||
pointer-events: auto; | ||
cursor: pointer; | ||
} | ||
} | ||
|
||
& .components-panel__body-toggle, | ||
& .edit-post-post-visibility__toggle, | ||
& .editor-post-trash, | ||
& .edit-post-post-schedule__toggle, | ||
& .components-menu-item__button { | ||
opacity: 1; | ||
pointer-events: auto; | ||
cursor: pointer; | ||
} | ||
|
||
& #post-sticky-toggle-0 { | ||
pointer-events: auto; | ||
cursor: pointer; | ||
} | ||
|
||
& .edit-post-last-revision__panel { | ||
display: none; | ||
} | ||
|
||
} |
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 |
---|---|---|
@@ -0,0 +1,36 @@ | ||
import { wp, dtGutenberg } from 'window'; | ||
|
||
const { registerPlugin } = wp.plugins; | ||
const { PluginPostStatusInfo } = wp.editPost; | ||
const { __ } = wp.i18n; | ||
const { PanelRow } = wp.components; | ||
|
||
const renderDistributedFrom = () => { | ||
return( | ||
<PluginPostStatusInfo> | ||
<span id='distributed-from'> | ||
{ __( 'Distributed on: ' ) } | ||
<strong> { dtGutenberg.syndicationTime } </strong> | ||
</span> | ||
</PluginPostStatusInfo> | ||
) | ||
} | ||
|
||
const renderDistributedTo = () => { | ||
return( | ||
<PluginPostStatusInfo> | ||
<span id='distributed-to'> | ||
{ wp.i18n.sprintf( | ||
wp.i18n.__( "Distributed to %1$s connection%2$s.", 'distributor' ), | ||
dtGutenberg.syndicationCount, | ||
'1' === dtGutenberg.syndicationCount ? '' : 's' | ||
) } | ||
</span> | ||
</PluginPostStatusInfo> | ||
) | ||
} | ||
|
||
const renderFunction = ( dtGutenberg.syndicationCount > 0 ) ? renderDistributedTo : renderDistributedFrom | ||
|
||
registerPlugin( 'distributor-status-panel', { render: renderFunction } ); | ||
|
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 |
---|---|---|
@@ -0,0 +1,76 @@ | ||
import { wp, dtGutenberg } from 'window' | ||
const { registerPlugin } = wp.plugins; | ||
|
||
|
||
wp.i18n.setLocaleData( dtGutenberg.i18n, 'distributor' ) | ||
|
||
if ( '0' !== dtGutenberg.originalSourceId ) { | ||
|
||
const messages = [] | ||
|
||
if ( parseInt( dtGutenberg.originalDeleted ) ) { | ||
messages.push( wp.i18n.sprintf( wp.i18n.__( 'This %s was distributed from ' ), dtGutenberg.postTypeSingular ) ) | ||
messages.push( wp.element.createElement( 'a', { | ||
href: dtGutenberg.postUrl, | ||
key: 'original-location-link' | ||
}, [ | ||
dtGutenberg.originalLocationName | ||
] ) ) | ||
messages.push( wp.i18n.__( '. However, the original has been deleted.' ) ) | ||
} else if ( ! parseInt( dtGutenberg.unlinked ) ) { | ||
messages.push( wp.i18n.__( 'Distributed from ', 'distributor' ) ) | ||
|
||
messages.push( wp.element.createElement( 'a', { | ||
href: dtGutenberg.postUrl, | ||
key: 'original-location-link' | ||
}, [ | ||
dtGutenberg.originalLocationName | ||
] ) ) | ||
|
||
messages.push( '.' ) | ||
|
||
messages.push( | ||
wp.element.createElement( 'span', { | ||
key: 'message-span' | ||
}, [ | ||
wp.i18n.sprintf( wp.i18n.__( " The original %1$s will update this version unless you ", 'distributor' ), dtGutenberg.postTypeSingular.toLowerCase() ), | ||
wp.element.createElement( 'a', { | ||
href: dtGutenberg.unlinkNonceUrl, | ||
key: 'original-unlink' | ||
}, [ | ||
wp.i18n.__( 'unlink from the original.', 'distributor' ) | ||
] ) | ||
] ) ) | ||
} else { | ||
messages.push( wp.i18n.__( 'Originally distributed from ', 'distributor' ) ) | ||
|
||
messages.push( wp.element.createElement( 'a', { | ||
href: dtGutenberg.postUrl, | ||
key: 'original-location-link' | ||
}, [ | ||
dtGutenberg.originalLocationName | ||
] ) ) | ||
|
||
messages.push( '.' ) | ||
|
||
messages.push( wp.element.createElement( 'span', { | ||
key: 'message-span' | ||
}, [ | ||
wp.i18n.sprintf( wp.i18n.__( " This %1$s has been unlinked from the original. However, you can always ", 'distributor' ), dtGutenberg.postTypeSingular.toLowerCase() ), | ||
wp.element.createElement( 'a', { | ||
href: dtGutenberg.linkNonceUrl, | ||
key: 'original-restore-link' | ||
}, [ | ||
wp.i18n.__( 'restore it.', 'distributor' ) | ||
] ) | ||
] ) ) | ||
} | ||
|
||
const messageElement = wp.element.createElement( 'p', { | ||
className: 'dt-message-wrapper' | ||
}, messages ) | ||
|
||
wp.data.dispatch( 'core/editor' ).createWarningNotice( messageElement, { | ||
isDismissible: false | ||
} ) | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.