diff --git a/public/js/UnleashApp.jsx b/public/js/UnleashApp.jsx index 2ec4379c05..b407773a5c 100644 --- a/public/js/UnleashApp.jsx +++ b/public/js/UnleashApp.jsx @@ -1,20 +1,11 @@ var React = require('react'); -var UserStore = require('./stores/UserStore'); +var Router = require('react-router'); var Menu = require('./components/Menu'); var ErrorMessages = require('./components/ErrorMessages'); var initalizer = require('./stores/initalizer'); -var LogEntriesComponent = require('./components/log/LogEntriesComponent'); -var FeatureTogglesComponent = require('./components/feature/FeatureTogglesComponent'); -var StrategiesComponent = require('./components/strategy/StrategiesComponent'); -var ArchiveFeatureComponent = require('./components/feature/ArchiveFeatureComponent'); -var Router = require('react-router'); -var DefaultRoute = Router.DefaultRoute; var Link = Router.Link; -var Route = Router.Route; var RouteHandler = Router.RouteHandler; -UserStore.init(); - var UnleashApp = React.createClass({ contextTypes: { router: React.PropTypes.func @@ -24,22 +15,22 @@ var UnleashApp = React.createClass({ initalizer(30); }, + renderLink: function(id, label) { + return ( + + {label} + + ); + }, + render: function () { return (
- - Features - - - Strategies - - - Log - - - Archive - + {this.renderLink("features", "Toggles")} + {this.renderLink("strategies", "Strategies")} + {this.renderLink("log", "Log")} + {this.renderLink("archive", "Archive")}
@@ -58,18 +49,5 @@ var UnleashApp = React.createClass({ } }); -var routes = ( - - - - - - -); - -Router.run(routes, function (Handler) { - React.render(, document.getElementById('content')); -}); - module.exports = UnleashApp; diff --git a/public/js/app.jsx b/public/js/app.jsx new file mode 100644 index 0000000000..948026dd48 --- /dev/null +++ b/public/js/app.jsx @@ -0,0 +1,10 @@ +var React = require('react'); +var Router = require('react-router'); +var UserStore = require('./stores/UserStore'); +var routes = require('./routes'); + +UserStore.init(); + +Router.run(routes, function (Handler) { + React.render(, document.getElementById('content')); +}); diff --git a/public/js/routes.jsx b/public/js/routes.jsx new file mode 100644 index 0000000000..7b0d3fd2d8 --- /dev/null +++ b/public/js/routes.jsx @@ -0,0 +1,20 @@ +var React = require('react'); +var Router = require('react-router'); +var UnleashApp = require('./UnleashApp'); +var LogEntriesComponent = require('./components/log/LogEntriesComponent'); +var FeatureTogglesComponent = require('./components/feature/FeatureTogglesComponent'); +var StrategiesComponent = require('./components/strategy/StrategiesComponent'); +var ArchiveFeatureComponent = require('./components/feature/ArchiveFeatureComponent'); +var DefaultRoute = Router.DefaultRoute; +var Route = Router.Route; + +var routes = ( + + + + + + +); + +module.exports = routes; diff --git a/webpack.config.js b/webpack.config.js index 97421d878c..efbae1e6d8 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -7,7 +7,7 @@ var js_root = path.join(path.join(root, 'public'), 'js'); module.exports = { context: js_root, - entry: 'UnleashApp', + entry: 'app', output: { path: js_root,