Re-do document creation

This commit is contained in:
Jori Lallo
2017-02-09 21:39:50 -08:00
parent 41efc7ecd7
commit 820c0fd8b4
3 changed files with 26 additions and 15 deletions

View File

@@ -88,9 +88,12 @@ class DocumentScene extends React.Component {
browserHistory.push(url);
}
onCreate = () => {
const url = `${this.store.document.url}/new`;
browserHistory.push(url);
onCreateDocument = () => {
browserHistory.push(`${this.store.collectionTree.url}/new`);
}
onCreateChild = () => {
browserHistory.push(`${this.store.document.url}/new`);
}
onDelete = () => {
@@ -142,8 +145,12 @@ class DocumentScene extends React.Component {
actions = (
<div className={ styles.actions }>
<DropdownMenu label={ <MoreIcon /> }>
{ this.store.isCollection &&
<MenuItem onClick={ this.onCreate }>New document</MenuItem> }
{ this.store.isCollection && (
<div className={ styles.menuGroup }>
<MenuItem onClick={ this.onCreateDocument }>New document</MenuItem>
<MenuItem onClick={ this.onCreateChild }>New child</MenuItem>
</div>
) }
<MenuItem onClick={ this.onEdit }>Edit</MenuItem>
<MenuItem onClick={ this.onExport }>Export</MenuItem>
{ allowDelete && <MenuItem onClick={ this.onDelete }>Delete</MenuItem> }

View File

@@ -7,3 +7,7 @@
position: relative;
overflow: scroll;
}
.menuGroup {
border-bottom: 1px solid #eee;
}

View File

@@ -50,18 +50,18 @@ class Sidebar extends React.Component {
/>
</Flex>
<Flex auto className={ styles.actions }>
<Link
to={ `${this.props.navigationTree.url}/new` }
className={ cx(styles.action) }
>
Add document
</Link>
<Separator />
<a
href
{ this.store.isEditing && (
<span className={ styles.action }>
Drag & drop to organize <Separator />&nbsp;
</span>
) }
<span
role="button"
onClick={ this.toggleEdit }
className={ cx(styles.action, { active: this.store.isEditing }) }
>Organize</a>
>
{ !this.store.isEditing ? 'Organize documents' : 'Save' }
</span>
</Flex>
</Flex>
) }