mirror of
https://github.com/ascribe/onion.git
synced 2024-12-22 09:23:13 +01:00
first iteration: whitelabel pages depending on customer
This commit is contained in:
parent
eb6e3cb20a
commit
ac45283968
@ -65,12 +65,15 @@ class AppGateway {
|
||||
|
||||
load(settings) {
|
||||
let type = 'default';
|
||||
let subdomain = 'www';
|
||||
|
||||
if (settings) {
|
||||
type = settings.type;
|
||||
subdomain = settings.subdomain;
|
||||
}
|
||||
|
||||
EventActions.applicationWillBoot(settings);
|
||||
Router.run(getRoutes(type), Router.HistoryLocation, (App) => {
|
||||
Router.run(getRoutes(type, subdomain), Router.HistoryLocation, (App) => {
|
||||
React.render(
|
||||
<App />,
|
||||
document.getElementById('main')
|
||||
|
@ -1,15 +1,15 @@
|
||||
'use strict';
|
||||
|
||||
import React from 'react';
|
||||
import RegisterPiece from '../../../register_piece';
|
||||
import Property from '../../../ascribe_forms/property';
|
||||
import InputTextAreaToggable from '../../../ascribe_forms/input_textarea_toggable';
|
||||
import InputCheckbox from '../../../ascribe_forms/input_checkbox';
|
||||
import RegisterPiece from '../../../../register_piece';
|
||||
import Property from '../../../../ascribe_forms/property';
|
||||
import InputTextAreaToggable from '../../../../ascribe_forms/input_textarea_toggable';
|
||||
import InputCheckbox from '../../../../ascribe_forms/input_checkbox';
|
||||
|
||||
import { getLangText } from '../../../../utils/lang_utils';
|
||||
import { getLangText } from '../../../../../utils/lang_utils';
|
||||
|
||||
|
||||
let WalletRegisterPiece = React.createClass({
|
||||
let CylandRegisterPiece = React.createClass({
|
||||
render() {
|
||||
return (
|
||||
<RegisterPiece
|
||||
@ -54,4 +54,4 @@ let WalletRegisterPiece = React.createClass({
|
||||
}
|
||||
});
|
||||
|
||||
export default WalletRegisterPiece;
|
||||
export default CylandRegisterPiece;
|
@ -3,7 +3,6 @@
|
||||
import React from 'react';
|
||||
import Router from 'react-router';
|
||||
import Header from '../../header';
|
||||
// import Footer from '../../footer';
|
||||
import GlobalNotification from '../../global_notification';
|
||||
|
||||
let RouteHandler = Router.RouteHandler;
|
||||
|
@ -7,34 +7,61 @@ 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 WalletRegisterPiece from './components/wallet_register_piece';
|
||||
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';
|
||||
|
||||
import WalletApp from './wallet_app';
|
||||
import AppConstants from '../../../constants/application_constants';
|
||||
|
||||
let Route = Router.Route;
|
||||
let Redirect = Router.Redirect;
|
||||
let baseUrl = AppConstants.baseUrl;
|
||||
|
||||
|
||||
function getRoutes() {
|
||||
return (
|
||||
let ROUTES = {
|
||||
'cyland': (
|
||||
<Route name="app" path={baseUrl} handler={WalletApp}>
|
||||
<Route name="landing" path={baseUrl} handler={WalletRegisterPiece} />
|
||||
<Route name="landing" path={baseUrl} handler={CylandRegisterPiece} />
|
||||
<Route name="login" path="login" handler={LoginContainer} />
|
||||
<Route name="logout" path="logout" handler={LogoutContainer} />
|
||||
<Route name="signup" path="signup" handler={SignupContainer} />
|
||||
<Route name="password_reset" path="password_reset" handler={PasswordResetContainer} />
|
||||
<Route name="register_piece" path="register_piece" handler={WalletRegisterPiece} />
|
||||
<Route name="register_piece" path="register_piece" handler={CylandRegisterPiece} />
|
||||
<Route name="pieces" path="collection" handler={PieceList} />
|
||||
<Route name="piece" path="pieces/:pieceId" handler={PieceContainer} />
|
||||
<Route name="edition" path="editions/:editionId" handler={EditionContainer} />
|
||||
<Route name="settings" path="settings" handler={SettingsContainer} />
|
||||
</Route>
|
||||
);
|
||||
),
|
||||
'cc': (
|
||||
<Route name="app" path={baseUrl} handler={WalletApp}>
|
||||
<Redirect from={baseUrl} to="login" />
|
||||
<Redirect from={baseUrl + '/'} to="login" />
|
||||
<Route name="login" path="login" handler={LoginContainer} />
|
||||
<Route name="logout" path="logout" handler={LogoutContainer} />
|
||||
<Route name="signup" path="signup" handler={SignupContainer} />
|
||||
<Route name="password_reset" path="password_reset" handler={PasswordResetContainer} />
|
||||
<Route name="register_piece" path="register_piece" handler={RegisterPiece} />
|
||||
<Route name="pieces" path="collection" handler={PieceList} />
|
||||
<Route name="piece" path="pieces/:pieceId" handler={PieceContainer} />
|
||||
<Route name="edition" path="editions/:editionId" handler={EditionContainer} />
|
||||
<Route name="settings" path="settings" handler={SettingsContainer} />
|
||||
</Route>
|
||||
)
|
||||
};
|
||||
|
||||
|
||||
function getRoutes(commonRoutes, subdomain) {
|
||||
if(subdomain in ROUTES) {
|
||||
return ROUTES[subdomain];
|
||||
} else {
|
||||
throw new Error('Subdomain wasn\'t specified in the wallet app.');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -43,13 +43,13 @@ const COMMON_ROUTES = (
|
||||
);
|
||||
|
||||
|
||||
function getRoutes(type) {
|
||||
function getRoutes(type, subdomain) {
|
||||
let routes = null;
|
||||
|
||||
if (type === 'prize') {
|
||||
routes = getPrizeRoutes(COMMON_ROUTES);
|
||||
routes = getPrizeRoutes(COMMON_ROUTES, subdomain);
|
||||
} else if(type === 'wallet') {
|
||||
routes = getWalletRoutes(COMMON_ROUTES);
|
||||
routes = getWalletRoutes(COMMON_ROUTES, subdomain);
|
||||
} else {
|
||||
routes = getDefaultRoutes(COMMON_ROUTES);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user