From ac45283968f59b92961eb5ab26dbd38ae84e0355 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim=20Daubensch=C3=BCtz?= Date: Tue, 11 Aug 2015 17:40:26 +0200 Subject: [PATCH] first iteration: whitelabel pages depending on customer --- js/app.js | 5 ++- .../cyland_register_piece.js} | 14 +++---- js/components/whitelabel/wallet/wallet_app.js | 1 - .../whitelabel/wallet/wallet_routes.js | 39 ++++++++++++++++--- js/routes.js | 6 +-- 5 files changed, 47 insertions(+), 18 deletions(-) rename js/components/whitelabel/wallet/components/{wallet_register_piece.js => cyland/cyland_register_piece.js} (81%) diff --git a/js/app.js b/js/app.js index 6115a0aa..6dcf58bf 100644 --- a/js/app.js +++ b/js/app.js @@ -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( , document.getElementById('main') diff --git a/js/components/whitelabel/wallet/components/wallet_register_piece.js b/js/components/whitelabel/wallet/components/cyland/cyland_register_piece.js similarity index 81% rename from js/components/whitelabel/wallet/components/wallet_register_piece.js rename to js/components/whitelabel/wallet/components/cyland/cyland_register_piece.js index 6b4d88fa..a5ff79b3 100644 --- a/js/components/whitelabel/wallet/components/wallet_register_piece.js +++ b/js/components/whitelabel/wallet/components/cyland/cyland_register_piece.js @@ -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 ( - + - + - ); + ), + 'cc': ( + + + + + + + + + + + + + + ) +}; + + +function getRoutes(commonRoutes, subdomain) { + if(subdomain in ROUTES) { + return ROUTES[subdomain]; + } else { + throw new Error('Subdomain wasn\'t specified in the wallet app.'); + } } diff --git a/js/routes.js b/js/routes.js index 4ee71070..65dfbaac 100644 --- a/js/routes.js +++ b/js/routes.js @@ -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); }