1
0
mirror of https://github.com/ascribe/onion.git synced 2024-11-14 17:15:08 +01:00

fix prev and next button for navigationheader

This commit is contained in:
Tim Daubenschütz 2015-08-12 17:30:39 +02:00
parent 7c0e2312a1
commit 81ff4641c7
2 changed files with 16 additions and 3 deletions

View File

@ -63,6 +63,13 @@ let PieceContainer = React.createClass({
UserStore.unlisten(this.onChange);
},
componentWillReceiveProps(nextProps) {
if(this.props.params.pieceId !== nextProps.params.pieceId) {
PieceActions.updatePiece({});
PieceActions.fetchOne(nextProps.params.pieceId);
}
},
onChange(state) {
this.setState(state);
},
@ -72,7 +79,6 @@ let PieceContainer = React.createClass({
},
render() {
console.log(this.props)
if('title' in this.state.piece) {
return (
<Piece
@ -120,12 +126,12 @@ let NavigationHeader = React.createClass({
return (
<div style={{marginBottom: '1em'}}>
<div className="row no-margin">
<Link to='piece' params={{pieceId: nav.prev_index ? nav.prev_index : this.props.piece.id}}>
<Link className="disable-select" 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: nav.next_index ? nav.next_index : this.props.piece.id}}>
<Link className="disable-select" 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>

View File

@ -391,4 +391,11 @@ hr {
.react-rating-caption {
font-size: 1em;
}
.disable-select {
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
}