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() {
|
||||
PieceStore.listen(this.onChange);
|
||||
PieceActions.fetchOne(this.props.params.pieceId);
|
||||
UserStore.listen(this.onChange);
|
||||
},
|
||||
|
||||
@ -62,15 +63,6 @@ let PieceContainer = React.createClass({
|
||||
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) {
|
||||
this.setState(state);
|
||||
},
|
||||
@ -123,15 +115,17 @@ let NavigationHeader = React.createClass({
|
||||
},
|
||||
|
||||
render() {
|
||||
if (this.props.currentUser && this.props.currentUser.is_jury && this.props.piece.navigation) {
|
||||
let nav = this.props.piece.navigation;
|
||||
return (
|
||||
<div style={{marginBottom: '1em'}}>
|
||||
<div className="row no-margin">
|
||||
<Link to='piece' params={{pieceId: this.props.piece.navigation.prev_index}}>
|
||||
<Link to='piece' params={{pieceId: nav.prev_index ? nav.prev_index : this.props.piece.id}}>
|
||||
<span className="glyphicon glyphicon-chevron-left pull-left" aria-hidden="true">
|
||||
Previous
|
||||
</span>
|
||||
</Link>
|
||||
<Link to='piece' params={{pieceId: this.props.piece.navigation.next_index}}>
|
||||
<Link to='piece' params={{pieceId: nav.next_index ? nav.next_index : this.props.piece.id}}>
|
||||
<span className="pull-right">
|
||||
Next
|
||||
<span className="glyphicon glyphicon-chevron-right" aria-hidden="true"></span>
|
||||
@ -141,6 +135,8 @@ let NavigationHeader = React.createClass({
|
||||
</div>
|
||||
);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user