1
0
mirror of https://github.com/moparisthebest/kaiwa synced 2024-11-17 14:55:05 -05:00
kaiwa/clientapp/app/router.js
2013-08-20 10:45:06 -07:00

38 lines
847 B
JavaScript

/*global app*/
var Backbone = require('backbone'),
staticPage = function (url) {
return function () {
var View = require('pages/wrapper');
app.renderPage(new View({
url: url
}));
};
};
module.exports = Backbone.Router.extend({
routes: {
'': 'main',
'info/:jid': 'info'
},
// ------- ROUTE HANDLERS ---------
main: function () {
var View = require('pages/main');
app.renderPage(new View({
model: me
}));
},
info: function (jid) {
var View = require('pages/info');
var contact = me.contacts.get(jid);
if (contact) {
app.renderPage(new View({
model: contact
}));
} else {
app.navigate('/');
}
}
});