nci/static/js/app/app.js

43 lines
941 B
JavaScript
Raw Normal View History

2015-04-10 20:17:03 +00:00
'use strict';
2015-04-12 22:41:09 +00:00
define([
2015-05-09 20:19:25 +00:00
'react',
'react-router',
2015-07-20 21:37:44 +00:00
'templates/app/components/app/index',
2015-05-17 13:48:16 +00:00
'app/components/index',
'app/actions/project', 'app/actions/build'
2015-04-12 22:41:09 +00:00
], function(
2015-05-09 20:19:25 +00:00
React,
Router,
2015-05-17 13:48:16 +00:00
template,
Components,
ProjectActions, BuildActions
2015-04-12 22:41:09 +00:00
) {
2015-05-09 20:19:25 +00:00
var Route = React.createFactory(Router.Route),
DefaultRoute = React.createFactory(Router.DefaultRoute);
var routes = (
Route({handler: Components.App},
Route({name: 'dashboard', path: '/', handler: Components.Dashboard}),
2015-07-09 20:12:24 +00:00
Route({
name: 'project',
2015-07-09 20:12:24 +00:00
path: 'projects/:name',
handler: Components.Project.View
}),
2015-10-03 14:14:41 +00:00
Route({name: 'build', path: 'builds/:id', handler: Components.Build.View}),
Route({
name: 'buildLog',
path: 'builds/:buildId/log',
handler: Components.BuildLog
})
2015-05-09 20:19:25 +00:00
)
);
Router.run(routes, Router.HistoryLocation, function(Handler) {
2015-05-17 13:48:16 +00:00
React.render(
React.createElement(Handler),
2015-05-17 13:48:16 +00:00
document.getElementById('content')
);
2015-05-09 20:19:25 +00:00
});
2015-04-10 20:17:03 +00:00
});