2012-04-09 18:11:39 +01:00
|
|
|
Rosa.Routers.CollaboratorsRouter = Backbone.Router.extend({
|
|
|
|
routes: {},
|
|
|
|
|
|
|
|
initialize: function() {
|
2012-04-12 22:44:53 +01:00
|
|
|
this.collaboratorsCollection = new Rosa.Collections.CollaboratorsCollection(Rosa.bootstrapedData.collaborators, { url: window.location.pathname });
|
|
|
|
this.searchCollection = new Rosa.Collections.CollaboratorsCollection(null, { url: window.location.pathname + '/find' });
|
|
|
|
this.tableView = new Rosa.Views.CollaboratorsView({ collection: this.collaboratorsCollection });
|
|
|
|
this.addView = new Rosa.Views.AddCollaboratorView({ collection: this.searchCollection });
|
2012-04-09 18:11:39 +01:00
|
|
|
|
2012-04-12 22:44:53 +01:00
|
|
|
this.addView.on('collaborator_prepared', this.collaboratorsCollection.saveAndAdd, this.collaboratorsCollection);
|
|
|
|
|
|
|
|
this.tableView.render();
|
|
|
|
this.addView.render();
|
2012-04-09 18:11:39 +01:00
|
|
|
}
|
|
|
|
});
|