mirror of
https://github.com/ascribe/onion.git
synced 2025-01-03 10:25:08 +01:00
Change: router rendering, router location, route configs, notFound routes, redirect routes,
This commit is contained in:
parent
5ded1e0760
commit
eebe936023
22
js/app.js
22
js/app.js
@ -3,7 +3,9 @@
|
||||
require('babel/polyfill');
|
||||
|
||||
import React from 'react';
|
||||
import Router from 'react-router';
|
||||
import { Router } from 'react-router';
|
||||
import createBrowserHistory from 'history/lib/createBrowserHistory';
|
||||
|
||||
|
||||
/* eslint-disable */
|
||||
import fetch from 'isomorphic-fetch';
|
||||
@ -74,16 +76,20 @@ class AppGateway {
|
||||
subdomain = settings.subdomain;
|
||||
}
|
||||
|
||||
// Adds a client specific class to the body for whitelabel styling
|
||||
window.document.body.classList.add('client--' + subdomain);
|
||||
|
||||
// Send the applicationWillBoot event to the third-party stores
|
||||
EventActions.applicationWillBoot(settings);
|
||||
window.appRouter = Router.run(getRoutes(type, subdomain), Router.HistoryLocation, (App) => {
|
||||
React.render(
|
||||
<App />,
|
||||
document.getElementById('main')
|
||||
);
|
||||
EventActions.routeDidChange();
|
||||
});
|
||||
|
||||
let history = createBrowserHistory();
|
||||
React.render((
|
||||
<Router history={history}>
|
||||
{getRoutes(type, subdomain)}
|
||||
</Router>
|
||||
), document.getElementById('main'));
|
||||
|
||||
// Send the applicationDidBoot event to the third-party stores
|
||||
EventActions.applicationDidBoot(settings);
|
||||
}
|
||||
}
|
||||
|
@ -1,7 +1,6 @@
|
||||
'use strict';
|
||||
|
||||
import React from 'react';
|
||||
import Router from 'react-router';
|
||||
import Header from '../components/header';
|
||||
import Footer from '../components/footer';
|
||||
import GlobalNotification from './global_notification';
|
||||
@ -9,14 +8,22 @@ import GlobalNotification from './global_notification';
|
||||
import getRoutes from '../routes';
|
||||
|
||||
|
||||
let RouteHandler = Router.RouteHandler;
|
||||
|
||||
let AscribeApp = React.createClass({
|
||||
propTypes: {
|
||||
children: React.PropTypes.oneOfType([
|
||||
React.PropTypes.arrayOf(React.PropTypes.element),
|
||||
React.PropTypes.element
|
||||
])
|
||||
},
|
||||
|
||||
render() {
|
||||
let { children } = this.props;
|
||||
|
||||
return (
|
||||
<div className="container ascribe-default-app">
|
||||
<Header routes={getRoutes()} />
|
||||
<RouteHandler />
|
||||
{/* Routes are injected here */}
|
||||
{children}
|
||||
<Footer />
|
||||
<GlobalNotification />
|
||||
<div id="modal" className="container"></div>
|
||||
|
@ -1,7 +1,7 @@
|
||||
'use strict';
|
||||
|
||||
import React from 'react';
|
||||
import Router from 'react-router';
|
||||
import { Route } from 'react-router';
|
||||
|
||||
import Landing from './components/prize_landing';
|
||||
import LoginContainer from './components/prize_login_container';
|
||||
@ -19,26 +19,24 @@ import ErrorNotFoundPage from '../../../components/error_not_found_page';
|
||||
import App from './prize_app';
|
||||
import AppConstants from '../../../constants/application_constants';
|
||||
|
||||
let Route = Router.Route;
|
||||
let NotFoundRoute = Router.NotFoundRoute;
|
||||
let baseUrl = AppConstants.baseUrl;
|
||||
|
||||
let baseUrl = AppConstants.baseUrl;
|
||||
|
||||
function getRoutes() {
|
||||
return (
|
||||
<Route name="app" path={baseUrl} handler={App}>
|
||||
<Route name="landing" path={baseUrl} handler={Landing} />
|
||||
<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={PrizeRegisterPiece} headerTitle="+ NEW WORK" />
|
||||
<Route name="pieces" path="collection" handler={PrizePieceList} headerTitle="COLLECTION" />
|
||||
<Route name="piece" path="pieces/:pieceId" handler={PrizePieceContainer} />
|
||||
<Route name="edition" path="editions/:editionId" handler={EditionContainer} />
|
||||
<Route name="settings" path="settings" handler={SettingsContainer} />
|
||||
<Route name="coa_verify" path="verify" handler={CoaVerifyContainer} />
|
||||
<NotFoundRoute name="notFound" handler={ErrorNotFoundPage} />
|
||||
<Route path={baseUrl} component={App}>
|
||||
<Route path={baseUrl} component={Landing} />
|
||||
<Route path="login" component={LoginContainer} />
|
||||
<Route path="logout" component={LogoutContainer} />
|
||||
<Route path="signup" component={SignupContainer} />
|
||||
<Route path="password_reset" component={PasswordResetContainer} />
|
||||
<Route path="register_piece" component={PrizeRegisterPiece} headerTitle="+ NEW WORK" />
|
||||
<Route path="collection" component={PrizePieceList} headerTitle="COLLECTION" />
|
||||
<Route path="pieces/:pieceId" component={PrizePieceContainer} />
|
||||
<Route path="editions/:editionId" component={EditionContainer} />
|
||||
<Route path="settings" component={SettingsContainer} />
|
||||
<Route path="verify" component={CoaVerifyContainer} />
|
||||
<Route path="*" component={ErrorNotFoundPage} />
|
||||
</Route>
|
||||
);
|
||||
}
|
||||
|
@ -1,7 +1,7 @@
|
||||
'use strict';
|
||||
|
||||
import React from 'react';
|
||||
import Router from 'react-router';
|
||||
import { Route, Redirect } from 'react-router';
|
||||
|
||||
// general components
|
||||
import CoaVerifyContainer from '../../../components/coa_verify_container';
|
||||
@ -33,64 +33,61 @@ import CCRegisterPiece from './components/cc/cc_register_piece';
|
||||
import WalletApp from './wallet_app';
|
||||
import AppConstants from '../../../constants/application_constants';
|
||||
|
||||
let Route = Router.Route;
|
||||
let NotFoundRoute = Router.NotFoundRoute;
|
||||
let Redirect = Router.Redirect;
|
||||
let baseUrl = AppConstants.baseUrl;
|
||||
|
||||
let baseUrl = AppConstants.baseUrl;
|
||||
|
||||
let ROUTES = {
|
||||
'cyland': (
|
||||
<Route name="app" path={baseUrl} handler={WalletApp}>
|
||||
<Route name="landing" path={baseUrl} handler={CylandLanding} />
|
||||
<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={CylandRegisterPiece} headerTitle="+ NEW WORK" />
|
||||
<Route name="pieces" path="collection" handler={CylandPieceList} headerTitle="COLLECTION" />
|
||||
<Route name="piece" path="pieces/:pieceId" handler={CylandPieceContainer} />
|
||||
<Route name="edition" path="editions/:editionId" handler={EditionContainer} />
|
||||
<Route name="coa_verify" path="verify" handler={CoaVerifyContainer} />
|
||||
<Route name="settings" path="settings" handler={SettingsContainer} />
|
||||
<Route name="contract_settings" path="contract_settings" handler={ContractSettings} />
|
||||
<NotFoundRoute name="notFound" handler={ErrorNotFoundPage} />
|
||||
<Route path={baseUrl} component={WalletApp}>
|
||||
<Route path={baseUrl} component={CylandLanding} />
|
||||
<Route path="login" component={LoginContainer} />
|
||||
<Route path="logout" component={LogoutContainer} />
|
||||
<Route path="signup" component={SignupContainer} />
|
||||
<Route path="password_reset" component={PasswordResetContainer} />
|
||||
<Route path="register_piece" component={CylandRegisterPiece} headerTitle="+ NEW WORK" />
|
||||
<Route path="collection" component={CylandPieceList} headerTitle="COLLECTION" />
|
||||
<Route path="pieces/:pieceId" component={CylandPieceContainer} />
|
||||
<Route path="editions/:editionId" component={EditionContainer} />
|
||||
<Route path="verify" component={CoaVerifyContainer} />
|
||||
<Route path="settings" component={SettingsContainer} />
|
||||
<Route path="contract_settings" component={ContractSettings} />
|
||||
<Route path="*" component={ErrorNotFoundPage} />
|
||||
</Route>
|
||||
),
|
||||
'cc': (
|
||||
<Route name="app" path={baseUrl} handler={WalletApp}>
|
||||
<Route path={baseUrl} component={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={CCRegisterPiece} headerTitle="+ NEW WORK" />
|
||||
<Route name="pieces" path="collection" handler={PieceList} headerTitle="COLLECTION" />
|
||||
<Route name="piece" path="pieces/:pieceId" handler={PieceContainer} />
|
||||
<Route name="edition" path="editions/:editionId" handler={EditionContainer} />
|
||||
<Route name="coa_verify" path="verify" handler={CoaVerifyContainer} />
|
||||
<Route name="settings" path="settings" handler={SettingsContainer} />
|
||||
<NotFoundRoute name="notFound" handler={ErrorNotFoundPage} />
|
||||
<Route path="login" component={LoginContainer} />
|
||||
<Route path="logout" component={LogoutContainer} />
|
||||
<Route path="signup" component={SignupContainer} />
|
||||
<Route path="password_reset" component={PasswordResetContainer} />
|
||||
<Route path="register_piece" component={CCRegisterPiece} headerTitle="+ NEW WORK" />
|
||||
<Route path="collection" component={PieceList} headerTitle="COLLECTION" />
|
||||
<Route path="pieces/:pieceId" component={PieceContainer} />
|
||||
<Route path="editions/:editionId" component={EditionContainer} />
|
||||
<Route path="verify" component={CoaVerifyContainer} />
|
||||
<Route path="settings" component={SettingsContainer} />
|
||||
<Route path="*" component={ErrorNotFoundPage} />
|
||||
</Route>
|
||||
),
|
||||
'ikonotv': (
|
||||
<Route name="app" path={baseUrl} handler={WalletApp}>
|
||||
<Route name="landing" path={baseUrl} handler={IkonotvLanding} />
|
||||
<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="request_loan" path="request_loan" handler={IkonotvRequestLoan} headerTitle="SEND NEW CONTRACT" aclName="acl_create_contractagreement" />
|
||||
<Route name="register_piece" path="register_piece" handler={IkonotvRegisterPiece} headerTitle="+ NEW WORK" aclName="acl_create_piece"/>
|
||||
<Route name="pieces" path="collection" handler={IkonotvPieceList} headerTitle="COLLECTION"/>
|
||||
<Route name="piece" path="pieces/:pieceId" handler={IkonotvPieceContainer} />
|
||||
<Route name="edition" path="editions/:editionId" handler={EditionContainer} />
|
||||
<Route name="coa_verify" path="verify" handler={CoaVerifyContainer} />
|
||||
<Route name="settings" path="settings" handler={SettingsContainer} />
|
||||
<Route name="contract_settings" path="contract_settings" handler={ContractSettings} />
|
||||
<Route name="contract_notifications" path="contract_notifications" handler={IkonotvContractNotifications} />
|
||||
<NotFoundRoute name="notFound" handler={ErrorNotFoundPage} />
|
||||
<Route path={baseUrl} component={WalletApp}>
|
||||
<Route path={baseUrl} component={IkonotvLanding} />
|
||||
<Route path="login" component={LoginContainer} />
|
||||
<Route path="logout" component={LogoutContainer} />
|
||||
<Route path="signup" component={SignupContainer} />
|
||||
<Route path="password_reset" component={PasswordResetContainer} />
|
||||
<Route path="request_loan" component={IkonotvRequestLoan} headerTitle="SEND NEW CONTRACT" aclName="acl_create_contractagreement" />
|
||||
<Route path="register_piece" component={IkonotvRegisterPiece} headerTitle="+ NEW WORK" aclName="acl_create_piece"/>
|
||||
<Route path="collection" component={IkonotvPieceList} headerTitle="COLLECTION"/>
|
||||
<Route path="pieces/:pieceId" component={IkonotvPieceContainer} />
|
||||
<Route path="editions/:editionId" component={EditionContainer} />
|
||||
<Route path="verify" component={CoaVerifyContainer} />
|
||||
<Route path="settings" component={SettingsContainer} />
|
||||
<Route path="contract_settings" component={ContractSettings} />
|
||||
<Route path="contract_notifications" component={IkonotvContractNotifications} />
|
||||
<Route path="*" component={ErrorNotFoundPage} />
|
||||
</Route>
|
||||
)
|
||||
};
|
||||
|
37
js/routes.js
37
js/routes.js
@ -1,7 +1,7 @@
|
||||
'use strict';
|
||||
|
||||
import React from 'react';
|
||||
import Router from 'react-router';
|
||||
import { Route, Redirect } from 'react-router';
|
||||
|
||||
import getPrizeRoutes from './components/whitelabel/prize/prize_routes';
|
||||
import getWalletRoutes from './components/whitelabel/wallet/wallet_routes';
|
||||
@ -27,28 +27,25 @@ import RegisterPiece from './components/register_piece';
|
||||
|
||||
import AppConstants from './constants/application_constants';
|
||||
|
||||
let Route = Router.Route;
|
||||
let NotFoundRoute = Router.NotFoundRoute;
|
||||
let Redirect = Router.Redirect;
|
||||
|
||||
let baseUrl = AppConstants.baseUrl;
|
||||
|
||||
|
||||
const COMMON_ROUTES = (
|
||||
<Route name="app" path={baseUrl} handler={App}>
|
||||
<Redirect from={baseUrl} to="login" />
|
||||
<Redirect from={baseUrl + '/'} to="login" />
|
||||
<Route name="signup" path="signup" handler={SignupContainer} />
|
||||
<Route name="login" path="login" handler={LoginContainer} />
|
||||
<Route name="logout" path="logout" handler={LogoutContainer} />
|
||||
<Route name="register_piece" path="register_piece" handler={RegisterPiece} headerTitle="+ NEW WORK" />
|
||||
<Route name="pieces" path="collection" handler={PieceList} headerTitle="COLLECTION" />
|
||||
<Route name="piece" path="pieces/:pieceId" handler={PieceContainer} />
|
||||
<Route name="edition" path="editions/:editionId" handler={EditionContainer} />
|
||||
<Route name="password_reset" path="password_reset" handler={PasswordResetContainer} />
|
||||
<Route name="settings" path="settings" handler={SettingsContainer} />
|
||||
<Route name="contract_settings" path="contract_settings" handler={ContractSettings} />
|
||||
<Route name="coa_verify" path="verify" handler={CoaVerifyContainer} />
|
||||
<NotFoundRoute name="notFound" handler={ErrorNotFoundPage} />
|
||||
<Route path={baseUrl} component={App}>
|
||||
<Redirect from={baseUrl} to="/login" />
|
||||
<Redirect from={baseUrl + '/'} to="/login" />
|
||||
<Route path="signup" component={SignupContainer} />
|
||||
<Route path="login" component={LoginContainer} />
|
||||
<Route path="logout" component={LogoutContainer} />
|
||||
<Route path="register_piece" component={RegisterPiece} headerTitle="+ NEW WORK" />
|
||||
<Route path="collection" component={PieceList} headerTitle="COLLECTION" />
|
||||
<Route path="pieces/:pieceId" component={PieceContainer} />
|
||||
<Route path="editions/:editionId" component={EditionContainer} />
|
||||
<Route path="password_reset" component={PasswordResetContainer} />
|
||||
<Route path="settings" component={SettingsContainer} />
|
||||
<Route path="contract_settings" component={ContractSettings} />
|
||||
<Route path="verify" component={CoaVerifyContainer} />
|
||||
<Route path="*" component={ErrorNotFoundPage} />
|
||||
</Route>
|
||||
);
|
||||
|
||||
|
@ -64,6 +64,7 @@
|
||||
"gulp-uglify": "^1.2.0",
|
||||
"gulp-util": "^3.0.4",
|
||||
"harmonize": "^1.4.2",
|
||||
"history": "^1.11.1",
|
||||
"isomorphic-fetch": "^2.0.2",
|
||||
"jest-cli": "^0.4.0",
|
||||
"lodash": "^3.9.3",
|
||||
|
Loading…
Reference in New Issue
Block a user