Skip to content

Commit

Permalink
Add new entry button on edit schema entry page relax#23
Browse files Browse the repository at this point in the history
  • Loading branch information
bruno12mota committed Sep 24, 2015
1 parent 81b4152 commit 10c5a47
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions lib/components/admin/panels/schema-entry/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,13 @@ export default class SchemaEntry extends Component {
};
}

componentDidUpdate () {
if ((!this.state.new && !this.context.schemaEntry) ||
(this.state.new && this.context.schemaEntry)) {
this.setState(this.getInitialState());
}
}

componentWillUnmount () {
super.componentWillUnmount();
if (this.successTimeout) {
Expand Down Expand Up @@ -411,6 +418,12 @@ export default class SchemaEntry extends Component {
<div className='content'>
<div className='filter-menu'>
<Breadcrumbs data={this.state.breadcrumbs} />
{!this.state.new &&
<A href={'/admin/schema/'+this.context.schema.slug+'/new'} className='button-clean'>
<i className='material-icons'>library_add</i>
<span>Add new entry</span>
</A>
}
</div>
<div className='admin-scrollable'>
<div className='white-options list'>
Expand Down

0 comments on commit 10c5a47

Please sign in to comment.