1
0
mirror of https://github.com/ascribe/onion.git synced 2024-12-23 01:39:36 +01:00

fix slideContainer broken functionality

This commit is contained in:
Tim Daubenschütz 2015-08-19 15:54:13 +02:00
parent 8a88f978c6
commit 0b4b3fa727
2 changed files with 10 additions and 4 deletions

View File

@ -92,6 +92,12 @@ let SlidesContainer = React.createClass({
}); });
}, },
// When the start_from parameter is used, this.setSlideNum can not simply be used anymore.
nextSlide() {
let nextSlide = this.state.slideNum + 1;
this.setSlideNum(nextSlide);
},
// We let every one from the outsite set the page number of the slider, // We let every one from the outsite set the page number of the slider,
// though only if the slideNum is actually in the range of our children-list. // though only if the slideNum is actually in the range of our children-list.
setSlideNum(slideNum) { setSlideNum(slideNum) {
@ -122,7 +128,7 @@ let SlidesContainer = React.createClass({
// if slideNum is within the range of slides and none of the previous cases // if slideNum is within the range of slides and none of the previous cases
// where matched, we can actually do transitions // where matched, we can actually do transitions
} else if(slideNum >= 0 || slideNum < React.Children.count(this.props.children)) { } else if(slideNum >= 0 || slideNum < this.customChildrenCount()) {
if(slideNum !== this.state.slideNum - 1) { if(slideNum !== this.state.slideNum - 1) {
// Bootstrapping the component, getInitialState is called once to save // Bootstrapping the component, getInitialState is called once to save
@ -249,7 +255,7 @@ let SlidesContainer = React.createClass({
<div <div
className="container ascribe-sliding-container" className="container ascribe-sliding-container"
style={{ style={{
width: this.state.containerWidth * React.Children.count(this.props.children), width: this.state.containerWidth * this.customChildrenCount(),
transform: 'translateX(' + (-1) * this.state.containerWidth * this.state.slideNum + 'px)' transform: 'translateX(' + (-1) * this.state.containerWidth * this.state.slideNum + 'px)'
}}> }}>
<div className="row"> <div className="row">

View File

@ -97,11 +97,11 @@ let CylandRegisterPiece = React.createClass({
PieceActions.updatePiece(response.piece); PieceActions.updatePiece(response.piece);
} }
this.refs.slidesContainer.setSlideNum(1); this.refs.slidesContainer.nextSlide();
}, },
handleAdditionalDataSuccess() { handleAdditionalDataSuccess() {
this.refs.slidesContainer.setSlideNum(2); this.refs.slidesContainer.nextSlide();
}, },
handleLoanSuccess(response) { handleLoanSuccess(response) {