mirror of
https://github.com/ascribe/onion.git
synced 2024-06-30 05:31:58 +02:00
ikono register
This commit is contained in:
parent
e933b334c2
commit
188cca4834
|
@ -16,6 +16,9 @@ import PieceStore from '../../../../../stores/piece_store';
|
||||||
import PieceActions from '../../../../../actions/piece_actions';
|
import PieceActions from '../../../../../actions/piece_actions';
|
||||||
|
|
||||||
import ContractForm from './ascribe_forms/ikonotv_contract_form';
|
import ContractForm from './ascribe_forms/ikonotv_contract_form';
|
||||||
|
import RegisterPieceForm from '../../../../../components/ascribe_forms/form_register_piece';
|
||||||
|
import Property from '../../../../../components/ascribe_forms/property';
|
||||||
|
import InputCheckbox from '../../../../../components/ascribe_forms/input_checkbox';
|
||||||
|
|
||||||
import GlobalNotificationModel from '../../../../../models/global_notification_model';
|
import GlobalNotificationModel from '../../../../../models/global_notification_model';
|
||||||
import GlobalNotificationActions from '../../../../../actions/global_notification_actions';
|
import GlobalNotificationActions from '../../../../../actions/global_notification_actions';
|
||||||
|
@ -31,88 +34,45 @@ let IkonotvRegisterPiece = React.createClass({
|
||||||
getInitialState(){
|
getInitialState(){
|
||||||
return mergeOptions(
|
return mergeOptions(
|
||||||
UserStore.getState(),
|
UserStore.getState(),
|
||||||
PieceListStore.getState(),
|
|
||||||
PieceStore.getState(),
|
|
||||||
WhitelabelStore.getState());
|
WhitelabelStore.getState());
|
||||||
},
|
},
|
||||||
|
|
||||||
componentDidMount() {
|
componentDidMount() {
|
||||||
PieceListStore.listen(this.onChange);
|
|
||||||
UserStore.listen(this.onChange);
|
UserStore.listen(this.onChange);
|
||||||
PieceStore.listen(this.onChange);
|
|
||||||
WhitelabelStore.listen(this.onChange);
|
WhitelabelStore.listen(this.onChange);
|
||||||
UserActions.fetchCurrentUser();
|
UserActions.fetchCurrentUser();
|
||||||
WhitelabelActions.fetchWhitelabel();
|
WhitelabelActions.fetchWhitelabel();
|
||||||
},
|
},
|
||||||
|
|
||||||
componentWillUnmount() {
|
componentWillUnmount() {
|
||||||
PieceListStore.unlisten(this.onChange);
|
|
||||||
UserStore.unlisten(this.onChange);
|
UserStore.unlisten(this.onChange);
|
||||||
PieceStore.unlisten(this.onChange);
|
|
||||||
WhitelabelStore.unlisten(this.onChange);
|
WhitelabelStore.unlisten(this.onChange);
|
||||||
},
|
},
|
||||||
|
|
||||||
onChange(state) {
|
onChange(state) {
|
||||||
this.setState(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
|
|
||||||
});
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
|
|
||||||
handleRegisterSuccess(response){
|
|
||||||
|
|
||||||
// once the user was able to register a piece successfully, we need to make sure to keep
|
|
||||||
// the piece list up to date
|
|
||||||
PieceListActions.fetchPieceList(
|
|
||||||
this.state.page,
|
|
||||||
this.state.pageSize,
|
|
||||||
this.state.searchTerm,
|
|
||||||
this.state.orderBy,
|
|
||||||
this.state.orderAsc,
|
|
||||||
this.state.filterBy
|
|
||||||
);
|
|
||||||
|
|
||||||
// also start loading the piece for the next step
|
|
||||||
if(response && response.piece) {
|
|
||||||
PieceActions.updatePiece(response.piece);
|
|
||||||
}
|
|
||||||
|
|
||||||
this.refs.slidesContainer.setSlideNum(1);
|
|
||||||
},
|
|
||||||
|
|
||||||
handleAdditionalDataSuccess() {
|
|
||||||
this.refs.slidesContainer.setSlideNum(2);
|
|
||||||
},
|
|
||||||
|
|
||||||
handleLoanSuccess(response) {
|
|
||||||
let notification = new GlobalNotificationModel(response.notification, 'success', 10000);
|
|
||||||
GlobalNotificationActions.appendGlobalNotification(notification);
|
|
||||||
PieceActions.fetchOne(this.state.piece.id);
|
|
||||||
this.transitionTo('piece', {pieceId: this.state.piece.id});
|
|
||||||
},
|
|
||||||
|
|
||||||
changeSlide() {
|
|
||||||
// only transition to the login store, if user is not logged in
|
|
||||||
// ergo the currentUser object is not properly defined
|
|
||||||
if(this.state.currentUser && !this.state.currentUser.email) {
|
|
||||||
this.onLoggedOut();
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
// basically redirects to the second slide (index: 1), when the user is not logged in
|
|
||||||
onLoggedOut() {
|
|
||||||
this.transitionTo('login');
|
|
||||||
},
|
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
|
if (this.state.currentUser &&
|
||||||
|
this.state.whitelabel &&
|
||||||
|
this.state.whitelabel.user &&
|
||||||
|
this.state.currentUser.email === this.state.whitelabel.user){
|
||||||
|
return (
|
||||||
|
<ContractForm />
|
||||||
|
);
|
||||||
|
}
|
||||||
return (
|
return (
|
||||||
<ContractForm />
|
<div className="ascribe-form-bordered ascribe-form-wrapper">
|
||||||
|
<RegisterPieceForm
|
||||||
|
enableLocalHashing={false}
|
||||||
|
headerMessage={getLangText('Register your work')}
|
||||||
|
submitMessage={getLangText('Register')}
|
||||||
|
handleSuccess={this.handleRegisterSuccess}/>
|
||||||
|
</div>
|
||||||
);
|
);
|
||||||
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -14,6 +14,7 @@ import EditionContainer from '../../../components/ascribe_detail/edition_contain
|
||||||
import SettingsContainer from '../../../components/settings_container';
|
import SettingsContainer from '../../../components/settings_container';
|
||||||
|
|
||||||
// specific components
|
// specific components
|
||||||
|
import CylandLanding from './components/cyland/cyland_landing';
|
||||||
import CylandPieceContainer from './components/cyland/ascribe_detail/cyland_piece_container';
|
import CylandPieceContainer from './components/cyland/ascribe_detail/cyland_piece_container';
|
||||||
import CylandRegisterPiece from './components/cyland/cyland_register_piece';
|
import CylandRegisterPiece from './components/cyland/cyland_register_piece';
|
||||||
import CylandPieceList from './components/cyland/cyland_piece_list';
|
import CylandPieceList from './components/cyland/cyland_piece_list';
|
||||||
|
@ -34,7 +35,7 @@ let baseUrl = AppConstants.baseUrl;
|
||||||
let ROUTES = {
|
let ROUTES = {
|
||||||
'cyland': (
|
'cyland': (
|
||||||
<Route name="app" path={baseUrl} handler={WalletApp}>
|
<Route name="app" path={baseUrl} handler={WalletApp}>
|
||||||
<Route name="landing" path={baseUrl} handler={CylandRegisterPiece} />
|
<Route name="landing" path={baseUrl} handler={CylandLanding} />
|
||||||
<Route name="login" path="login" handler={LoginContainer} />
|
<Route name="login" path="login" handler={LoginContainer} />
|
||||||
<Route name="logout" path="logout" handler={LogoutContainer} />
|
<Route name="logout" path="logout" handler={LogoutContainer} />
|
||||||
<Route name="signup" path="signup" handler={SignupContainer} />
|
<Route name="signup" path="signup" handler={SignupContainer} />
|
||||||
|
|
Loading…
Reference in New Issue
Block a user