Skip to content

Commit

Permalink
Hide create new button for single files.
Browse files Browse the repository at this point in the history
  • Loading branch information
tech4him1 committed Mar 27, 2018
1 parent cc60dc9 commit 7f516f7
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions src/components/Editor/EditorToolbar.js
Original file line number Diff line number Diff line change
Expand Up @@ -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>;
}
Expand All @@ -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>
);
Expand Down Expand Up @@ -106,6 +110,7 @@ export default class EditorToolbar extends React.Component {

renderWorkflowPublishControls = () => {
const {
collection,
onPersist,
onPersistAndNew,
isUpdatingStatus,
Expand Down Expand Up @@ -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>
];
}
Expand Down

0 comments on commit 7f516f7

Please sign in to comment.