mirror of
https://github.com/ascribe/onion.git
synced 2025-02-14 21:10:27 +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) {
|
load(settings) {
|
||||||
let type = 'default';
|
let type = 'default';
|
||||||
|
let subdomain = 'www';
|
||||||
|
|
||||||
if (settings) {
|
if (settings) {
|
||||||
type = settings.type;
|
type = settings.type;
|
||||||
|
subdomain = settings.subdomain;
|
||||||
}
|
}
|
||||||
|
|
||||||
EventActions.applicationWillBoot(settings);
|
EventActions.applicationWillBoot(settings);
|
||||||
Router.run(getRoutes(type), Router.HistoryLocation, (App) => {
|
Router.run(getRoutes(type, subdomain), Router.HistoryLocation, (App) => {
|
||||||
React.render(
|
React.render(
|
||||||
<App />,
|
<App />,
|
||||||
document.getElementById('main')
|
document.getElementById('main')
|
||||||
|
@ -1,15 +1,15 @@
|
|||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import RegisterPiece from '../../../register_piece';
|
import RegisterPiece from '../../../../register_piece';
|
||||||
import Property from '../../../ascribe_forms/property';
|
import Property from '../../../../ascribe_forms/property';
|
||||||
import InputTextAreaToggable from '../../../ascribe_forms/input_textarea_toggable';
|
import InputTextAreaToggable from '../../../../ascribe_forms/input_textarea_toggable';
|
||||||
import InputCheckbox from '../../../ascribe_forms/input_checkbox';
|
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() {
|
render() {
|
||||||
return (
|
return (
|
||||||
<RegisterPiece
|
<RegisterPiece
|
||||||
@ -54,4 +54,4 @@ let WalletRegisterPiece = React.createClass({
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
export default WalletRegisterPiece;
|
export default CylandRegisterPiece;
|
@ -3,7 +3,6 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import Router from 'react-router';
|
import Router from 'react-router';
|
||||||
import Header from '../../header';
|
import Header from '../../header';
|
||||||
// import Footer from '../../footer';
|
|
||||||
import GlobalNotification from '../../global_notification';
|
import GlobalNotification from '../../global_notification';
|
||||||
|
|
||||||
let RouteHandler = Router.RouteHandler;
|
let RouteHandler = Router.RouteHandler;
|
||||||
|
@ -7,34 +7,61 @@ import LoginContainer from '../../../components/login_container';
|
|||||||
import LogoutContainer from '../../../components/logout_container';
|
import LogoutContainer from '../../../components/logout_container';
|
||||||
import SignupContainer from '../../../components/signup_container';
|
import SignupContainer from '../../../components/signup_container';
|
||||||
import PasswordResetContainer from '../../../components/password_reset_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 PieceList from '../../../components/piece_list';
|
||||||
import PieceContainer from '../../../components/ascribe_detail/piece_container';
|
import PieceContainer from '../../../components/ascribe_detail/piece_container';
|
||||||
import EditionContainer from '../../../components/ascribe_detail/edition_container';
|
import EditionContainer from '../../../components/ascribe_detail/edition_container';
|
||||||
import SettingsContainer from '../../../components/settings_container';
|
import SettingsContainer from '../../../components/settings_container';
|
||||||
|
|
||||||
|
import RegisterPiece from '../../../components/register_piece';
|
||||||
|
|
||||||
import WalletApp from './wallet_app';
|
import WalletApp from './wallet_app';
|
||||||
import AppConstants from '../../../constants/application_constants';
|
import AppConstants from '../../../constants/application_constants';
|
||||||
|
|
||||||
let Route = Router.Route;
|
let Route = Router.Route;
|
||||||
|
let Redirect = Router.Redirect;
|
||||||
let baseUrl = AppConstants.baseUrl;
|
let baseUrl = AppConstants.baseUrl;
|
||||||
|
|
||||||
|
|
||||||
function getRoutes() {
|
let ROUTES = {
|
||||||
return (
|
'cyland': (
|
||||||
<Route name="app" path={baseUrl} handler={WalletApp}>
|
<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="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} />
|
||||||
<Route name="password_reset" path="password_reset" handler={PasswordResetContainer} />
|
<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="pieces" path="collection" handler={PieceList} />
|
||||||
<Route name="piece" path="pieces/:pieceId" handler={PieceContainer} />
|
<Route name="piece" path="pieces/:pieceId" handler={PieceContainer} />
|
||||||
<Route name="edition" path="editions/:editionId" handler={EditionContainer} />
|
<Route name="edition" path="editions/:editionId" handler={EditionContainer} />
|
||||||
<Route name="settings" path="settings" handler={SettingsContainer} />
|
<Route name="settings" path="settings" handler={SettingsContainer} />
|
||||||
</Route>
|
</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;
|
let routes = null;
|
||||||
|
|
||||||
if (type === 'prize') {
|
if (type === 'prize') {
|
||||||
routes = getPrizeRoutes(COMMON_ROUTES);
|
routes = getPrizeRoutes(COMMON_ROUTES, subdomain);
|
||||||
} else if(type === 'wallet') {
|
} else if(type === 'wallet') {
|
||||||
routes = getWalletRoutes(COMMON_ROUTES);
|
routes = getWalletRoutes(COMMON_ROUTES, subdomain);
|
||||||
} else {
|
} else {
|
||||||
routes = getDefaultRoutes(COMMON_ROUTES);
|
routes = getDefaultRoutes(COMMON_ROUTES);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user