2012-10-26 05:12:21 +08:00
|
|
|
// Filename: router.js
|
|
|
|
define([
|
|
|
|
'jquery',
|
|
|
|
'underscore',
|
|
|
|
'backbone'
|
|
|
|
], function($, _, Backbone ){
|
|
|
|
var AppRouter = Backbone.Router.extend({
|
|
|
|
routes: {
|
|
|
|
// Default. We only have one route.
|
|
|
|
'*actions': 'defaultAction'
|
|
|
|
}
|
|
|
|
});
|
|
|
|
var initialize = function(){
|
|
|
|
var app_router = new AppRouter;
|
|
|
|
app_router.on('route:defaultAction', function (actions) {
|
2012-10-27 02:07:43 +08:00
|
|
|
require(['views/users/list'], function(UserListView) {
|
2012-10-26 05:12:21 +08:00
|
|
|
console.log("Opening main view");
|
|
|
|
// We have no matching route, lets display the home page
|
2012-10-27 02:07:43 +08:00
|
|
|
var usersView = new UserListView();
|
|
|
|
usersView.render();
|
2012-10-26 05:12:21 +08:00
|
|
|
});
|
|
|
|
});
|
|
|
|
Backbone.history.start();
|
|
|
|
};
|
|
|
|
return {
|
|
|
|
initialize: initialize
|
|
|
|
};
|
|
|
|
});
|