mirror of
https://github.com/ascribe/onion.git
synced 2025-01-03 18:35:09 +01:00
small fix and more comments
This commit is contained in:
parent
20a83167ab
commit
7daef3b082
@ -73,6 +73,7 @@ let LoginForm = React.createClass({
|
||||
// register_piece is listening to the changes of the user_store.
|
||||
UserActions.fetchCurrentUser()
|
||||
.then(() => {
|
||||
if(this.props.redirectOnLoginSuccess) {
|
||||
/* Taken from http://stackoverflow.com/a/14916411 */
|
||||
/*
|
||||
We actually have to trick the Browser into showing the "save password" dialog
|
||||
@ -80,9 +81,12 @@ let LoginForm = React.createClass({
|
||||
Users on Stack Overflow claim this is a bug in chrome and should be fixed in the future.
|
||||
Until then, we redirect the HARD way, but reloading the whole page using window.location
|
||||
*/
|
||||
if(this.props.redirectOnLoginSuccess) {
|
||||
window.location = AppConstants.baseUrl + 'collection';
|
||||
} else if(this.props.onLogin) {
|
||||
// In some instances we want to give a callback to an outer container,
|
||||
// to show that the one login action the user triggered actually went through.
|
||||
// We can not do this by listening on a store's state as it wouldn't really tell us
|
||||
// if the user did log in or was just fetching the user's data again
|
||||
this.props.onLogin();
|
||||
}
|
||||
})
|
||||
|
@ -82,8 +82,15 @@ let SlidesContainer = React.createClass({
|
||||
// if slideNum is within the range of slides and none of the previous cases
|
||||
// where matched, we can actually do transitions
|
||||
} else if(slideNum >= 0 || slideNum < React.Children.count(this.props.children)) {
|
||||
if(slideNum !== this.state.slideNum - 1 && !document.referrer) {
|
||||
|
||||
if(slideNum !== this.state.slideNum - 1) {
|
||||
// Bootstrapping the component, getInitialState is called once to save
|
||||
// the tabs history length.
|
||||
// In order to know if we already pushed a new state on the history stack or not,
|
||||
// we're comparing the old history length with the new one and if it didn't change then
|
||||
// we push a new state on it ONCE (ever).
|
||||
// Otherwise, we're able to use the browsers history.forward() method
|
||||
// to keep the stack clean
|
||||
if(this.state.historyLength === window.history.length) {
|
||||
this.transitionTo(this.getPathname(), null, {slide_num: slideNum});
|
||||
} else {
|
||||
|
@ -81,6 +81,13 @@ let RegisterPiece = React.createClass( {
|
||||
|
||||
onChange(state) {
|
||||
this.setState(state);
|
||||
|
||||
if(this.state.currentUser && this.state.currentUser.email) {
|
||||
// we should also make the fineuploader component editable again
|
||||
this.setState({
|
||||
isFineUploaderActive: true
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
handleSuccess(response){
|
||||
@ -166,10 +173,6 @@ let RegisterPiece = React.createClass( {
|
||||
// register_piece slide
|
||||
if(this.state.currentUser && this.state.currentUser.email) {
|
||||
window.history.back();
|
||||
// we should also make the fineuploader component editable again
|
||||
this.setState({
|
||||
isFineUploaderActive: true
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user