Skip to content

Commit 7f516f7

Browse files
committed
Hide create new button for single files.
1 parent cc60dc9 commit 7f516f7

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

src/components/Editor/EditorToolbar.js

+12-3
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ export default class EditorToolbar extends React.Component {
5050
};
5151

5252
renderSimplePublishControls = () => {
53-
const { onPersist, onPersistAndNew, isPersisting, hasChanged, isNewEntry } = this.props;
53+
const { collection, onPersist, onPersistAndNew, isPersisting, hasChanged, isNewEntry } = this.props;
5454
if (!isNewEntry && !hasChanged) {
5555
return <div className="nc-entryEditor-toolbar-statusPublished">Published</div>;
5656
}
@@ -64,7 +64,11 @@ export default class EditorToolbar extends React.Component {
6464
label={isPersisting ? 'Publishing...' : 'Publish'}
6565
>
6666
<DropdownItem label="Publish now" icon="arrow" iconDirection="right" onClick={onPersist}/>
67-
<DropdownItem label="Publish and create new" icon="add" onClick={onPersistAndNew}/>
67+
{
68+
collection.get('create')
69+
? <DropdownItem label="Publish and create new" icon="add" onClick={onPersistAndNew}/>
70+
: null
71+
}
6872
</Dropdown>
6973
</div>
7074
);
@@ -106,6 +110,7 @@ export default class EditorToolbar extends React.Component {
106110

107111
renderWorkflowPublishControls = () => {
108112
const {
113+
collection,
109114
onPersist,
110115
onPersistAndNew,
111116
isUpdatingStatus,
@@ -152,7 +157,11 @@ export default class EditorToolbar extends React.Component {
152157
label={isPublishing ? 'Publishing...' : 'Publish'}
153158
>
154159
<DropdownItem label="Publish now" icon="arrow" iconDirection="right" onClick={onPublish}/>
155-
<DropdownItem label="Publish and create new" icon="add" onClick={onPublishAndNew}/>
160+
{
161+
collection.get('create')
162+
? <DropdownItem label="Publish and create new" icon="add" onClick={onPublishAndNew}/>
163+
: null
164+
}
156165
</Dropdown>
157166
];
158167
}

0 commit comments

Comments
 (0)