Hide create new button for single files.

This commit is contained in:
Caleb 2018-03-27 12:33:19 -06:00 committed by Shawn Erquhart
parent 79ddb3b91c
commit 21469148fb

View File

@ -50,7 +50,7 @@ export default class EditorToolbar extends React.Component {
};
renderSimplePublishControls = () => {
const { onPersist, onPersistAndNew, isPersisting, hasChanged, isNewEntry } = this.props;
const { collection, onPersist, onPersistAndNew, isPersisting, hasChanged, isNewEntry } = this.props;
if (!isNewEntry && !hasChanged) {
return <div className="nc-entryEditor-toolbar-statusPublished">Published</div>;
}
@ -64,7 +64,11 @@ export default class EditorToolbar extends React.Component {
label={isPersisting ? 'Publishing...' : 'Publish'}
>
<DropdownItem label="Publish now" icon="arrow" iconDirection="right" onClick={onPersist}/>
<DropdownItem label="Publish and create new" icon="add" onClick={onPersistAndNew}/>
{
collection.get('create')
? <DropdownItem label="Publish and create new" icon="add" onClick={onPersistAndNew}/>
: null
}
</Dropdown>
</div>
);
@ -106,6 +110,7 @@ export default class EditorToolbar extends React.Component {
renderWorkflowPublishControls = () => {
const {
collection,
onPersist,
onPersistAndNew,
isUpdatingStatus,
@ -152,7 +157,11 @@ export default class EditorToolbar extends React.Component {
label={isPublishing ? 'Publishing...' : 'Publish'}
>
<DropdownItem label="Publish now" icon="arrow" iconDirection="right" onClick={onPublish}/>
<DropdownItem label="Publish and create new" icon="add" onClick={onPublishAndNew}/>
{
collection.get('create')
? <DropdownItem label="Publish and create new" icon="add" onClick={onPublishAndNew}/>
: null
}
</Dropdown>
];
}