Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hide create new button for single files. #1200

Merged
merged 1 commit into from
Mar 28, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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