mirror of
https://github.com/ascribe/onion.git
synced 2025-01-03 10:25:08 +01:00
revert piece navigation and bug fix in navigation serializer
This commit is contained in:
parent
97c298e304
commit
7c0e2312a1
@ -49,6 +49,7 @@ let PieceContainer = React.createClass({
|
|||||||
|
|
||||||
componentDidMount() {
|
componentDidMount() {
|
||||||
PieceStore.listen(this.onChange);
|
PieceStore.listen(this.onChange);
|
||||||
|
PieceActions.fetchOne(this.props.params.pieceId);
|
||||||
UserStore.listen(this.onChange);
|
UserStore.listen(this.onChange);
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -62,15 +63,6 @@ let PieceContainer = React.createClass({
|
|||||||
UserStore.unlisten(this.onChange);
|
UserStore.unlisten(this.onChange);
|
||||||
},
|
},
|
||||||
|
|
||||||
componentDidUpdate() {
|
|
||||||
console.log('call me ')
|
|
||||||
PieceActions.fetchOne(this.props.params.pieceId);
|
|
||||||
},
|
|
||||||
|
|
||||||
shouldComponentUpdate(nextProps, nextState) {
|
|
||||||
return this.props.params.pieceId !== nextProps.params.pieceId
|
|
||||||
},
|
|
||||||
|
|
||||||
onChange(state) {
|
onChange(state) {
|
||||||
this.setState(state);
|
this.setState(state);
|
||||||
},
|
},
|
||||||
@ -123,23 +115,27 @@ let NavigationHeader = React.createClass({
|
|||||||
},
|
},
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
return (
|
if (this.props.currentUser && this.props.currentUser.is_jury && this.props.piece.navigation) {
|
||||||
<div style={{marginBottom: '1em'}}>
|
let nav = this.props.piece.navigation;
|
||||||
<div className="row no-margin">
|
return (
|
||||||
<Link to='piece' params={{pieceId: this.props.piece.navigation.prev_index}}>
|
<div style={{marginBottom: '1em'}}>
|
||||||
<span className="glyphicon glyphicon-chevron-left pull-left" aria-hidden="true">
|
<div className="row no-margin">
|
||||||
Previous
|
<Link to='piece' params={{pieceId: nav.prev_index ? nav.prev_index : this.props.piece.id}}>
|
||||||
</span>
|
<span className="glyphicon glyphicon-chevron-left pull-left" aria-hidden="true">
|
||||||
</Link>
|
Previous
|
||||||
<Link to='piece' params={{pieceId: this.props.piece.navigation.next_index}}>
|
</span>
|
||||||
<span className="pull-right">
|
</Link>
|
||||||
Next
|
<Link to='piece' params={{pieceId: nav.next_index ? nav.next_index : this.props.piece.id}}>
|
||||||
<span className="glyphicon glyphicon-chevron-right" aria-hidden="true"></span>
|
<span className="pull-right">
|
||||||
</span>
|
Next
|
||||||
</Link>
|
<span className="glyphicon glyphicon-chevron-right" aria-hidden="true"></span>
|
||||||
|
</span>
|
||||||
|
</Link>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
);
|
||||||
);
|
}
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user