Remove bad delete restriction
This commit is contained in:
@ -65,7 +65,6 @@ class CollectionMenu extends Component {
|
|||||||
|
|
||||||
render() {
|
render() {
|
||||||
const { collection, label, onOpen, onClose } = this.props;
|
const { collection, label, onOpen, onClose } = this.props;
|
||||||
const { allowDelete } = collection;
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<span>
|
<span>
|
||||||
@ -91,9 +90,7 @@ class CollectionMenu extends Component {
|
|||||||
<DropdownMenuItem onClick={this.onEdit}>Edit…</DropdownMenuItem>
|
<DropdownMenuItem onClick={this.onEdit}>Edit…</DropdownMenuItem>
|
||||||
</Flex>
|
</Flex>
|
||||||
)}
|
)}
|
||||||
{allowDelete && (
|
|
||||||
<DropdownMenuItem onClick={this.onDelete}>Delete…</DropdownMenuItem>
|
<DropdownMenuItem onClick={this.onDelete}>Delete…</DropdownMenuItem>
|
||||||
)}
|
|
||||||
</DropdownMenu>
|
</DropdownMenu>
|
||||||
</span>
|
</span>
|
||||||
);
|
);
|
||||||
|
@ -47,7 +47,6 @@ class DocumentMenu extends Component {
|
|||||||
|
|
||||||
render() {
|
render() {
|
||||||
const { document, label } = this.props;
|
const { document, label } = this.props;
|
||||||
const { allowDelete } = document;
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<DropdownMenu label={label || <MoreIcon />}>
|
<DropdownMenu label={label || <MoreIcon />}>
|
||||||
@ -69,11 +68,7 @@ class DocumentMenu extends Component {
|
|||||||
</DropdownMenuItem>
|
</DropdownMenuItem>
|
||||||
<DropdownMenuItem onClick={window.print}>Print</DropdownMenuItem>
|
<DropdownMenuItem onClick={window.print}>Print</DropdownMenuItem>
|
||||||
<DropdownMenuItem onClick={this.handleMove}>Move…</DropdownMenuItem>
|
<DropdownMenuItem onClick={this.handleMove}>Move…</DropdownMenuItem>
|
||||||
{allowDelete && (
|
<DropdownMenuItem onClick={this.handleDelete}>Delete…</DropdownMenuItem>
|
||||||
<DropdownMenuItem onClick={this.handleDelete}>
|
|
||||||
Delete…
|
|
||||||
</DropdownMenuItem>
|
|
||||||
)}
|
|
||||||
</DropdownMenu>
|
</DropdownMenu>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -33,11 +33,6 @@ class Collection extends BaseModel {
|
|||||||
: this.url;
|
: this.url;
|
||||||
}
|
}
|
||||||
|
|
||||||
@computed
|
|
||||||
get allowDelete(): boolean {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@computed
|
@computed
|
||||||
get isEmpty(): boolean {
|
get isEmpty(): boolean {
|
||||||
return this.documents.length === 0;
|
return this.documents.length === 0;
|
||||||
|
@ -89,17 +89,6 @@ class Document extends BaseModel {
|
|||||||
return !this.isEmpty && !this.isSaving;
|
return !this.isEmpty && !this.isSaving;
|
||||||
}
|
}
|
||||||
|
|
||||||
@computed
|
|
||||||
get allowDelete(): boolean {
|
|
||||||
const collection = this.collection;
|
|
||||||
return (
|
|
||||||
collection &&
|
|
||||||
collection.type === 'atlas' &&
|
|
||||||
collection.documents &&
|
|
||||||
collection.documents.length > 1
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
@computed
|
@computed
|
||||||
get parentDocumentId(): ?string {
|
get parentDocumentId(): ?string {
|
||||||
return this.pathToDocument.length > 1
|
return this.pathToDocument.length > 1
|
||||||
|
Reference in New Issue
Block a user