mirror of
https://github.com/opensupports/opensupports.git
synced 2025-07-29 16:54:53 +02:00
[Ivan Diaz] - Update react-router
This commit is contained in:
parent
673ccae39e
commit
6b1aa7aa60
@ -51,7 +51,7 @@
|
|||||||
"react": "^0.13.x",
|
"react": "^0.13.x",
|
||||||
"react-document-title": "^1.0.2",
|
"react-document-title": "^1.0.2",
|
||||||
"react-motion": "^0.3.0",
|
"react-motion": "^0.3.0",
|
||||||
"react-router": "^0.13.x",
|
"react-router": "^1.0.0-rc1",
|
||||||
"reflux": "^0.2.9",
|
"reflux": "^0.2.9",
|
||||||
"run-sequence": "^1.1.1",
|
"run-sequence": "^1.1.1",
|
||||||
"superagent": "^1.2.0",
|
"superagent": "^1.2.0",
|
||||||
|
@ -13,8 +13,7 @@ var App = React.createClass({
|
|||||||
render() {
|
render() {
|
||||||
return (
|
return (
|
||||||
<div>
|
<div>
|
||||||
<RouteHandler params={this.props.params}
|
{this.props.children}
|
||||||
query={this.props.query} />
|
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
import React from 'react/addons';
|
import React from 'react/addons';
|
||||||
import {Route, NotFoundRoute, DefaultRoute} from 'react-router';
|
import {Router, Route, IndexRoute} from 'react-router';
|
||||||
|
import CreateBrowserHistory from 'react-router/node_modules/history/lib/createBrowserHistory';
|
||||||
|
|
||||||
import App from 'app/App';
|
import App from 'app/App';
|
||||||
import DemoPage from 'app/demo/components-demo-page';
|
import DemoPage from 'app/demo/components-demo-page';
|
||||||
@ -10,14 +11,16 @@ import MainSignUpPage from 'app/main/main-signup/main-sign
|
|||||||
|
|
||||||
|
|
||||||
export default (
|
export default (
|
||||||
<Route handler={App} path='/'>
|
<Router history={CreateBrowserHistory()}>
|
||||||
|
<Route component={App} path='/'>
|
||||||
|
|
||||||
<Route name='main' path='/app' handler={MainLayout}>
|
<Route path='/app' component={MainLayout}>
|
||||||
<DefaultRoute name='home' handler={MainHomePage} />
|
<IndexRoute component={MainHomePage} />
|
||||||
<Route name='signup' path='/app/signup' handler={MainSignUpPage}/>
|
<Route path='signup' component={MainSignUpPage}/>
|
||||||
</Route>
|
</Route>
|
||||||
|
|
||||||
<Route name='Demo' path='/demo' handler={DemoPage} />
|
<Route name='Demo' path='demo' component={DemoPage} />
|
||||||
|
|
||||||
</Route>
|
</Route>
|
||||||
|
</Router>
|
||||||
);
|
);
|
@ -8,6 +8,4 @@ if ( process.env.NODE_ENV !== 'production' ) {
|
|||||||
window.React = React;
|
window.React = React;
|
||||||
}
|
}
|
||||||
|
|
||||||
Router.run(routes, Router.HistoryLocation, (Handler, state) => {
|
React.render(routes, document.getElementById('app'));
|
||||||
React.render(<Handler params={state.params} query={state.query} />, document.getElementById('app'));
|
|
||||||
});
|
|
@ -9,8 +9,8 @@ var MainLayoutHeader = React.createClass({
|
|||||||
return (
|
return (
|
||||||
<div className="main-layout-header">
|
<div className="main-layout-header">
|
||||||
<div className="main-layout-header--login-links">
|
<div className="main-layout-header--login-links">
|
||||||
<Button type="clean" route={{to:'home'}}>{i18n('LOG_IN')}</Button>
|
<Button type="clean" route={{to:'/app'}}>{i18n('LOG_IN')}</Button>
|
||||||
<Button type="clean" route={{to:'signup'}}>Sign up</Button>
|
<Button type="clean" route={{to:'/app/signup'}}>Sign up</Button>
|
||||||
<Button type="clean" onClick={function () {CommonActions.changeLanguage('es');}}>Spanish</Button>
|
<Button type="clean" onClick={function () {CommonActions.changeLanguage('es');}}>Spanish</Button>
|
||||||
<Button type="clean" onClick={function () {CommonActions.changeLanguage('en');}}>English</Button>
|
<Button type="clean" onClick={function () {CommonActions.changeLanguage('en');}}>English</Button>
|
||||||
</div>
|
</div>
|
||||||
|
@ -12,8 +12,7 @@ var MainLayout = React.createClass({
|
|||||||
|
|
||||||
<MainHeader />
|
<MainHeader />
|
||||||
|
|
||||||
<RouteHandler params={this.props.params}
|
{this.props.children}
|
||||||
query={this.props.query} />
|
|
||||||
|
|
||||||
<MainFooter />
|
<MainFooter />
|
||||||
|
|
||||||
|
@ -1,12 +1,12 @@
|
|||||||
import React from 'react/addons';
|
import React from 'react/addons';
|
||||||
import classNames from 'classnames';
|
import classNames from 'classnames';
|
||||||
import {Navigation} from 'react-router';
|
import {History} from 'react-router';
|
||||||
|
|
||||||
import callback from 'utils/callback';
|
import callback from 'utils/callback';
|
||||||
|
|
||||||
var Button = React.createClass({
|
var Button = React.createClass({
|
||||||
|
|
||||||
mixins: [Navigation],
|
mixins: [History],
|
||||||
|
|
||||||
propTypes: {
|
propTypes: {
|
||||||
children: React.PropTypes.node,
|
children: React.PropTypes.node,
|
||||||
@ -49,7 +49,7 @@ var Button = React.createClass({
|
|||||||
|
|
||||||
handleClick() {
|
handleClick() {
|
||||||
if (this.props.route) {
|
if (this.props.route) {
|
||||||
this.transitionTo(this.props.route.to, this.props.route.param, this.props.route.query);
|
this.history.pushState(null, this.props.route.to, this.props.route.query);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
Loading…
x
Reference in New Issue
Block a user