From 188cca483474e0122fa884fd436c06b6be430f0d Mon Sep 17 00:00:00 2001 From: diminator Date: Wed, 19 Aug 2015 09:31:36 +0200 Subject: [PATCH] ikono register --- .../ikonotv/ikonotv_register_piece.js | 78 +++++-------------- .../whitelabel/wallet/wallet_routes.js | 3 +- 2 files changed, 21 insertions(+), 60 deletions(-) diff --git a/js/components/whitelabel/wallet/components/ikonotv/ikonotv_register_piece.js b/js/components/whitelabel/wallet/components/ikonotv/ikonotv_register_piece.js index 34f03042..33cc576c 100644 --- a/js/components/whitelabel/wallet/components/ikonotv/ikonotv_register_piece.js +++ b/js/components/whitelabel/wallet/components/ikonotv/ikonotv_register_piece.js @@ -16,6 +16,9 @@ import PieceStore from '../../../../../stores/piece_store'; import PieceActions from '../../../../../actions/piece_actions'; 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 GlobalNotificationActions from '../../../../../actions/global_notification_actions'; @@ -31,88 +34,45 @@ let IkonotvRegisterPiece = React.createClass({ getInitialState(){ return mergeOptions( UserStore.getState(), - PieceListStore.getState(), - PieceStore.getState(), WhitelabelStore.getState()); }, componentDidMount() { - PieceListStore.listen(this.onChange); UserStore.listen(this.onChange); - PieceStore.listen(this.onChange); WhitelabelStore.listen(this.onChange); UserActions.fetchCurrentUser(); WhitelabelActions.fetchWhitelabel(); }, componentWillUnmount() { - PieceListStore.unlisten(this.onChange); UserStore.unlisten(this.onChange); - PieceStore.unlisten(this.onChange); WhitelabelStore.unlisten(this.onChange); }, 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 - }); - } }, - 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() { - + if (this.state.currentUser && + this.state.whitelabel && + this.state.whitelabel.user && + this.state.currentUser.email === this.state.whitelabel.user){ + return ( + + ); + } return ( - +
+ +
); + } }); diff --git a/js/components/whitelabel/wallet/wallet_routes.js b/js/components/whitelabel/wallet/wallet_routes.js index 8d7a4aa8..435b1695 100644 --- a/js/components/whitelabel/wallet/wallet_routes.js +++ b/js/components/whitelabel/wallet/wallet_routes.js @@ -14,6 +14,7 @@ import EditionContainer from '../../../components/ascribe_detail/edition_contain import SettingsContainer from '../../../components/settings_container'; // specific components +import CylandLanding from './components/cyland/cyland_landing'; import CylandPieceContainer from './components/cyland/ascribe_detail/cyland_piece_container'; import CylandRegisterPiece from './components/cyland/cyland_register_piece'; import CylandPieceList from './components/cyland/cyland_piece_list'; @@ -34,7 +35,7 @@ let baseUrl = AppConstants.baseUrl; let ROUTES = { 'cyland': ( - +