rosa-build/app/assets/javascripts/backbone/routers/collaborators_router.js

16 lines
793 B
JavaScript

Rosa.Routers.CollaboratorsRouter = Backbone.Router.extend({
routes: {},
initialize: function() {
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 });
this.addView.on('collaborator_prepared', this.collaboratorsCollection.saveAndAdd, this.collaboratorsCollection);
this.tableView.render();
this.addView.render();
}
});