diff --git a/js/components/ascribe_forms/form.js b/js/components/ascribe_forms/form.js index 2b956a7e..0b8d9994 100644 --- a/js/components/ascribe_forms/form.js +++ b/js/components/ascribe_forms/form.js @@ -103,6 +103,7 @@ let Form = React.createClass({ if ('getFormData' in this.props){ data = mergeOptionsWithDuplicates(data, this.props.getFormData()); } + console.log(data); return data; }, diff --git a/js/components/register_piece.js b/js/components/register_piece.js index 94ce4d33..4fbff2b9 100644 --- a/js/components/register_piece.js +++ b/js/components/register_piece.js @@ -54,7 +54,6 @@ let RegisterPiece = React.createClass( { getInitialState(){ return mergeOptions( - LicenseStore.getState(), UserStore.getState(), WhitelabelStore.getState(), PieceListStore.getState(), @@ -65,16 +64,13 @@ let RegisterPiece = React.createClass( { }, componentDidMount() { - LicenseActions.fetchLicense(); WhitelabelActions.fetchWhitelabel(); - LicenseStore.listen(this.onChange); PieceListStore.listen(this.onChange); UserStore.listen(this.onChange); WhitelabelStore.listen(this.onChange); }, componentWillUnmount() { - LicenseStore.unlisten(this.onChange); PieceListStore.unlisten(this.onChange); UserStore.unlisten(this.onChange); WhitelabelStore.unlisten(this.onChange); @@ -109,37 +105,6 @@ let RegisterPiece = React.createClass( { this.transitionTo('piece', {pieceId: response.piece.id}); }, - onLicenseChange(event){ - //console.log(this.state.licenses[event.target.selectedIndex].url); - this.setState({selectedLicense: event.target.selectedIndex}); - }, - getLicenses() { - if (this.state.licenses && this.state.licenses.length > 1) { - return ( - {getLangText('Learn more')} - }> - - ); - } - return null; - }, - getSpecifyEditions() { if(this.state.whitelabel && this.state.whitelabel.acl_create_editions || Object.keys(this.state.whitelabel).length === 0) { return ( @@ -192,7 +157,6 @@ let RegisterPiece = React.createClass( { handleSuccess={this.handleSuccess} onLoggedOut={this.onLoggedOut}> {this.props.children} - {this.getLicenses()} {this.getSpecifyEditions()} diff --git a/js/components/whitelabel/wallet/components/cc/cc_register_piece.js b/js/components/whitelabel/wallet/components/cc/cc_register_piece.js new file mode 100644 index 00000000..129c1b0a --- /dev/null +++ b/js/components/whitelabel/wallet/components/cc/cc_register_piece.js @@ -0,0 +1,85 @@ +'use strict'; + +import React from 'react'; +import RegisterPiece from '../../../../register_piece'; +import Property from '../../../../ascribe_forms/property'; + +import LicenseActions from '../../../../../actions/license_actions'; +import LicenseStore from '../../../../../stores/license_store'; + +import { getLangText } from '../../../../../utils/lang_utils'; +import { mergeOptions } from '../../../../../utils/general_utils'; + +let CCRegisterPiece = React.createClass({ + + getInitialState() { + return mergeOptions( + LicenseStore.getState(), + { + selectedLicense: 0 + } + ); + }, + + componentDidMount() { + LicenseStore.listen(this.onChange); + LicenseActions.fetchLicense(); + }, + + componentWillUnmount() { + LicenseStore.unlisten(this.onChange); + }, + + onChange(state) { + this.setState(state); + }, + + onLicenseChange(event){ + this.setState({selectedLicense: event.target.selectedIndex}); + }, + + getLicenses() { + if (this.state.licenses && this.state.licenses.length > 1) { + return ( + + {getLangText('Learn more')} + + }> + + ); + } + return null; + }, + + render() { + return ( + + {this.getLicenses()} + + ); + } +}); + +export default CCRegisterPiece; diff --git a/js/components/whitelabel/wallet/constants/wallet_api_urls.js b/js/components/whitelabel/wallet/constants/wallet_api_urls.js index 60ee8658..47c05c0a 100644 --- a/js/components/whitelabel/wallet/constants/wallet_api_urls.js +++ b/js/components/whitelabel/wallet/constants/wallet_api_urls.js @@ -1,11 +1,8 @@ 'use strict'; -import WalletAppConstants from './wallet_application_constants'; - -function getPrizeApiUrls(subdomain) { - return { - 'pieces_list': WalletAppConstants.walletApiEndpoint + subdomain + '/pieces/' - }; +// gets subdomain as a parameter +function getPrizeApiUrls() { + return {}; } export default getPrizeApiUrls; \ No newline at end of file diff --git a/js/components/whitelabel/wallet/wallet_routes.js b/js/components/whitelabel/wallet/wallet_routes.js index 487432ee..a0c80c17 100644 --- a/js/components/whitelabel/wallet/wallet_routes.js +++ b/js/components/whitelabel/wallet/wallet_routes.js @@ -3,17 +3,19 @@ import React from 'react'; import Router from 'react-router'; +// general components import LoginContainer from '../../../components/login_container'; import LogoutContainer from '../../../components/logout_container'; import SignupContainer from '../../../components/signup_container'; import PasswordResetContainer from '../../../components/password_reset_container'; -import CylandRegisterPiece from './components/cyland/cyland_register_piece'; import PieceList from '../../../components/piece_list'; import PieceContainer from '../../../components/ascribe_detail/piece_container'; import EditionContainer from '../../../components/ascribe_detail/edition_container'; import SettingsContainer from '../../../components/settings_container'; -import RegisterPiece from '../../../components/register_piece'; +// specific components +import CylandRegisterPiece from './components/cyland/cyland_register_piece'; +import CCRegisterPiece from './components/cc/cc_register_piece'; import WalletApp from './wallet_app'; import AppConstants from '../../../constants/application_constants'; @@ -46,7 +48,7 @@ let ROUTES = { - +