diff --git a/js/components/ascribe_settings/account_settings.js b/js/components/ascribe_settings/account_settings.js index b4d46b2d..0591b350 100644 --- a/js/components/ascribe_settings/account_settings.js +++ b/js/components/ascribe_settings/account_settings.js @@ -2,9 +2,6 @@ import React from 'react'; -import UserStore from '../../stores/user_store'; -import UserActions from '../../actions/user_actions'; - import GlobalNotificationModel from '../../models/global_notification_model'; import GlobalNotificationActions from '../../actions/global_notification_actions'; @@ -19,38 +16,26 @@ import AppConstants from '../../constants/application_constants'; import { getLangText } from '../../utils/lang_utils'; let AccountSettings = React.createClass({ - getInitialState() { - return UserStore.getState(); - }, - - componentDidMount() { - UserStore.listen(this.onChange); - UserActions.fetchCurrentUser(); - }, - - componentWillUnmount() { - UserStore.unlisten(this.onChange); - }, - - onChange(state) { - this.setState(state); + propTypes: { + currentUser: React.PropTypes.object.required, + loadUser: React.PropTypes.func.required }, handleSuccess(){ - UserActions.fetchCurrentUser(); + this.props.loadUser(); let notification = new GlobalNotificationModel(getLangText('Settings succesfully updated'), 'success', 5000); GlobalNotificationActions.appendGlobalNotification(notification); }, getFormDataProfile(){ - return {'email': this.state.currentUser.email}; + return {'email': this.props.currentUser.email}; }, render() { let content = ; let profile = null; - if (this.state.currentUser.username) { + if (this.props.currentUser.username) { content = (
@@ -70,7 +55,7 @@ let AccountSettings = React.createClass({ editable={false}> @@ -87,7 +72,7 @@ let AccountSettings = React.createClass({ className="ascribe-settings-property-collapsible-toggle" style={{paddingBottom: 0}}> + defaultChecked={this.props.currentUser.profile.hash_locally}> {' ' + getLangText('Enable hash option, e.g. slow connections or to keep piece private')} diff --git a/js/components/ascribe_settings/contract_settings.js b/js/components/ascribe_settings/contract_settings.js index c7abc682..889932af 100644 --- a/js/components/ascribe_settings/contract_settings.js +++ b/js/components/ascribe_settings/contract_settings.js @@ -14,11 +14,14 @@ import ContractSettingsUpdateButton from './contract_settings_update_button'; import GlobalNotificationModel from '../../models/global_notification_model'; import GlobalNotificationActions from '../../actions/global_notification_actions'; +import AclProxy from '../acl_proxy'; + import { getLangText } from '../../utils/lang_utils'; let ContractSettings = React.createClass({ propTypes: { + currentUser: React.PropTypes.object, defaultExpanded: React.PropTypes.bool }, @@ -79,80 +82,92 @@ let ContractSettings = React.createClass({ } return ( - + - {createPublicContractForm} - {publicContracts.map((contract, i) => { - return ( - - - - {getLangText('PREVIEW')} - - - - } - leftColumnWidth="40%" - rightColumnWidth="60%"/> - ); - })} + + + {createPublicContractForm} + {publicContracts.map((contract, i) => { + return ( + + + + {getLangText('PREVIEW')} + + + + } + leftColumnWidth="40%" + rightColumnWidth="60%"/> + ); + })} + + + + + + {privateContracts.map((contract, i) => { + return ( + + + + {getLangText('PREVIEW')} + + + + } + leftColumnWidth="40%" + rightColumnWidth="60%"/> + ); + })} + + - - - {privateContracts.map((contract, i) => { - return ( - - - - {getLangText('PREVIEW')} - - - - } - leftColumnWidth="40%" - rightColumnWidth="60%"/> - ); - })} - - + ); } }); diff --git a/js/components/ascribe_settings/settings_container.js b/js/components/ascribe_settings/settings_container.js index 2d2440bf..9b08af43 100644 --- a/js/components/ascribe_settings/settings_container.js +++ b/js/components/ascribe_settings/settings_container.js @@ -3,6 +3,9 @@ import React from 'react'; import Router from 'react-router'; +import UserStore from '../../stores/user_store'; +import UserActions from '../../actions/user_actions'; + import AccountSettings from './account_settings'; import BitcoinWalletSettings from './bitcoin_wallet_settings'; import ContractSettings from './contract_settings'; @@ -18,14 +21,35 @@ let SettingsContainer = React.createClass({ mixins: [Router.Navigation], + getInitialState() { + return UserStore.getState(); + }, + + componentDidMount() { + UserStore.listen(this.onChange); + UserActions.fetchCurrentUser(); + }, + + componentWillUnmount() { + UserStore.unlisten(this.onChange); + }, + + loadUser(){ + UserActions.fetchCurrentUser(); + }, + + onChange(state) { + this.setState(state); + }, + render() { return (
- + {this.props.children} - +
); } diff --git a/js/components/whitelabel/wallet/constants/wallet_api_urls.js b/js/components/whitelabel/wallet/constants/wallet_api_urls.js index e0d8a862..2cdc0054 100644 --- a/js/components/whitelabel/wallet/constants/wallet_api_urls.js +++ b/js/components/whitelabel/wallet/constants/wallet_api_urls.js @@ -8,7 +8,8 @@ function getWalletApiUrls(subdomain) { return { 'pieces_list': walletConstants.walletApiEndpoint + subdomain + '/pieces/', 'piece': walletConstants.walletApiEndpoint + subdomain + '/pieces/${piece_id}/', - 'piece_extradata': walletConstants.walletApiEndpoint + subdomain + '/pieces/${piece_id}/extradata/' + 'piece_extradata': walletConstants.walletApiEndpoint + subdomain + '/pieces/${piece_id}/extradata/', + 'user': walletConstants.walletApiEndpoint + subdomain + '/users/' }; } else if (subdomain === 'ikonotv'){