Skip to content

Commit

Permalink
Revert "Add label elements to scheduler and visibility (#3317)"
Browse files Browse the repository at this point in the history
This reverts commit 9c011c6.
  • Loading branch information
aduth authored Nov 7, 2017
1 parent 9c011c6 commit e5d8890
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 36 deletions.
26 changes: 8 additions & 18 deletions editor/sidebar/post-schedule/index.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,8 @@
/**
* External dependencies
*/
import { flowRight } from 'lodash';

/**
* WordPress dependencies
*/
import { __ } from '@wordpress/i18n';
import { PanelRow, Dropdown, withAPIData, withInstanceId } from '@wordpress/components';
import { PanelRow, Dropdown, withAPIData } from '@wordpress/components';

/**
* Internal dependencies
Expand All @@ -16,21 +11,19 @@ import './style.scss';
import PostScheduleLabel from '../../post-schedule/label';
import PostScheduleForm from '../../post-schedule';

export function PostSchedule( { user, instanceId } ) {
export function PostSchedule( { user } ) {
if ( ! user.data || ! user.data.capabilities.publish_posts ) {
return null;
}
const postScheduleSelectorId = 'post-schedule-selector-' + instanceId;

return (
<PanelRow className="editor-post-schedule">
<label htmlFor={ postScheduleSelectorId }>{ __( 'Publish' ) }</label>
<span>{ __( 'Publish' ) }</span>
<Dropdown
position="bottom left"
contentClassName="editor-post-schedule__dialog"
renderToggle={ ( { onToggle, isOpen } ) => (
<button
id={ postScheduleSelectorId }
type="button"
className="editor-post-schedule__toggle button-link"
onClick={ onToggle }
Expand All @@ -45,11 +38,8 @@ export function PostSchedule( { user, instanceId } ) {
);
}

const applyWithAPIData = withAPIData( () => ( {
user: '/wp/v2/users/me?context=edit',
} ) );

export default flowRight( [
applyWithAPIData,
withInstanceId,
] )( PostSchedule );
export default withAPIData( () => {
return {
user: '/wp/v2/users/me?context=edit',
};
} )( PostSchedule );
26 changes: 8 additions & 18 deletions editor/sidebar/post-visibility/index.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,8 @@
/**
* External dependencies
*/
import { flowRight } from 'lodash';

/**
* WordPress dependencies
*/
import { __ } from '@wordpress/i18n';
import { PanelRow, Dropdown, withAPIData, withInstanceId } from '@wordpress/components';
import { PanelRow, Dropdown, withAPIData } from '@wordpress/components';

/**
* Internal Dependencies
Expand All @@ -16,21 +11,19 @@ import './style.scss';
import PostVisibilityLabel from '../../post-visibility/label';
import PostVisibilityForm from '../../post-visibility';

export function PostVisibility( { user, instanceId } ) {
export function PostVisibility( { user } ) {
const canEdit = user.data && user.data.capabilities.publish_posts;
const postVisibilitySelectorId = 'post-visibility-selector-' + instanceId;

return (
<PanelRow className="editor-post-visibility">
<label htmlFor={ postVisibilitySelectorId }>{ __( 'Visibility' ) }</label>
<span>{ __( 'Visibility' ) }</span>
{ ! canEdit && <span><PostVisibilityLabel /></span> }
{ canEdit && (
<Dropdown
position="bottom left"
contentClassName="editor-post-visibility__dialog"
renderToggle={ ( { isOpen, onToggle } ) => (
<button
id={ postVisibilitySelectorId }
type="button"
aria-expanded={ isOpen }
className="editor-post-visibility__toggle button-link"
Expand All @@ -46,11 +39,8 @@ export function PostVisibility( { user, instanceId } ) {
);
}

const applyWithAPIData = withAPIData( () => ( {
user: '/wp/v2/users/me?context=edit',
} ) );

export default flowRight( [
applyWithAPIData,
withInstanceId,
] )( PostVisibility );
export default withAPIData( () => {
return {
user: '/wp/v2/users/me?context=edit',
};
} )( PostVisibility );

0 comments on commit e5d8890

Please sign in to comment.