1
0
mirror of https://github.com/ascribe/onion.git synced 2025-01-03 10:25: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); UserStore.unlisten(this.onChange);
}, },
componentWillReceiveProps(nextProps) {
if(this.props.params.pieceId !== nextProps.params.pieceId) {
PieceActions.updatePiece({});
PieceActions.fetchOne(nextProps.params.pieceId);
}
},
onChange(state) { onChange(state) {
this.setState(state); this.setState(state);
}, },
@ -72,7 +79,6 @@ let PieceContainer = React.createClass({
}, },
render() { render() {
console.log(this.props)
if('title' in this.state.piece) { if('title' in this.state.piece) {
return ( return (
<Piece <Piece
@ -120,12 +126,12 @@ let NavigationHeader = React.createClass({
return ( return (
<div style={{marginBottom: '1em'}}> <div style={{marginBottom: '1em'}}>
<div className="row no-margin"> <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"> <span className="glyphicon glyphicon-chevron-left pull-left" aria-hidden="true">
Previous Previous
</span> </span>
</Link> </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"> <span className="pull-right">
Next Next
<span className="glyphicon glyphicon-chevron-right" aria-hidden="true"></span> <span className="glyphicon glyphicon-chevron-right" aria-hidden="true"></span>

View File

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