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