Restores file import on sidebar menu
This commit is contained in:
@ -54,11 +54,19 @@ class DropToImport extends Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
for (const file of files) {
|
for (const file of files) {
|
||||||
await importFile({ file, documentId, collectionId, redirect }, doc => {
|
importFile(
|
||||||
|
{
|
||||||
|
documents: this.props.documents,
|
||||||
|
file,
|
||||||
|
documentId,
|
||||||
|
collectionId,
|
||||||
|
},
|
||||||
|
doc => {
|
||||||
if (redirect) {
|
if (redirect) {
|
||||||
this.props.history.push(doc.url);
|
this.props.history.push(doc.url);
|
||||||
}
|
}
|
||||||
});
|
}
|
||||||
|
);
|
||||||
}
|
}
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
// TODO: show error alert.
|
// TODO: show error alert.
|
||||||
|
@ -126,7 +126,8 @@ class CollectionLink extends Component {
|
|||||||
>
|
>
|
||||||
<CollectionName justify="space-between">
|
<CollectionName justify="space-between">
|
||||||
{collection.name}
|
{collection.name}
|
||||||
|
</CollectionName>
|
||||||
|
</SidebarLink>
|
||||||
<CollectionAction>
|
<CollectionAction>
|
||||||
<CollectionMenu
|
<CollectionMenu
|
||||||
history={history}
|
history={history}
|
||||||
@ -135,8 +136,6 @@ class CollectionLink extends Component {
|
|||||||
onClose={() => (this.menuOpen = false)}
|
onClose={() => (this.menuOpen = false)}
|
||||||
/>
|
/>
|
||||||
</CollectionAction>
|
</CollectionAction>
|
||||||
</CollectionName>
|
|
||||||
</SidebarLink>
|
|
||||||
</StyledDropToImport>
|
</StyledDropToImport>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@ -225,6 +224,7 @@ const CollectionName = styled(Flex)`
|
|||||||
const CollectionAction = styled.span`
|
const CollectionAction = styled.span`
|
||||||
position: absolute;
|
position: absolute;
|
||||||
right: 0;
|
right: 0;
|
||||||
|
top: 0;
|
||||||
color: ${color.slate};
|
color: ${color.slate};
|
||||||
svg {
|
svg {
|
||||||
opacity: 0.75;
|
opacity: 0.75;
|
||||||
@ -238,6 +238,8 @@ const CollectionAction = styled.span`
|
|||||||
`;
|
`;
|
||||||
|
|
||||||
const StyledDropToImport = styled(DropToImport)`
|
const StyledDropToImport = styled(DropToImport)`
|
||||||
|
position: relative;
|
||||||
|
|
||||||
${CollectionAction} {
|
${CollectionAction} {
|
||||||
display: ${props => (props.menuOpen ? 'inline' : 'none')};
|
display: ${props => (props.menuOpen ? 'inline' : 'none')};
|
||||||
}
|
}
|
||||||
|
@ -33,7 +33,9 @@ class CollectionMenu extends Component {
|
|||||||
history.push(`${collection.url}/new`);
|
history.push(`${collection.url}/new`);
|
||||||
};
|
};
|
||||||
|
|
||||||
onImportFile = (ev: SyntheticEvent) => {
|
onImportDocument = (ev: SyntheticEvent) => {
|
||||||
|
ev.preventDefault();
|
||||||
|
|
||||||
// simulate a click on the file upload input element
|
// simulate a click on the file upload input element
|
||||||
this.file.click();
|
this.file.click();
|
||||||
};
|
};
|
||||||
@ -87,7 +89,7 @@ class CollectionMenu extends Component {
|
|||||||
<DropdownMenuItem onClick={this.onNewDocument}>
|
<DropdownMenuItem onClick={this.onNewDocument}>
|
||||||
New document
|
New document
|
||||||
</DropdownMenuItem>
|
</DropdownMenuItem>
|
||||||
<DropdownMenuItem onClick={this.onImportFile}>
|
<DropdownMenuItem onClick={this.onImportDocument}>
|
||||||
Import document
|
Import document
|
||||||
</DropdownMenuItem>
|
</DropdownMenuItem>
|
||||||
<DropdownMenuItem onClick={this.onEdit}>Edit…</DropdownMenuItem>
|
<DropdownMenuItem onClick={this.onEdit}>Edit…</DropdownMenuItem>
|
||||||
|
Reference in New Issue
Block a user