Skip to content

Instantly share code, notes, and snippets.

@shinecita
Created September 6, 2012 20:42
Show Gist options
  • Save shinecita/3660225 to your computer and use it in GitHub Desktop.
Save shinecita/3660225 to your computer and use it in GitHub Desktop.
var OrganizationRouter = module.exports = Backbone.Router.extend({
routes: {
'o/:organizationName': 'show'
, 'createOrganization': 'add'
}
, show: function (orgUserName) {
$('body').removeClass();
$('body').addClass('organizations');
// var org = new Organization({id : orgUserName});
// org.fetch({success: function(){
// var view = new OrganizationView({model: org});
// Application.
// trigger('showSidebar', view);
// }
// });
console.log("Application.organizations", Application.organizations);
Application.organizations.findOrFetch(orgUserName, function(err, model) {
var view = new OrganizationView({model: model});
Application.
trigger('showSidebar', view);
});
}
, add: function(){
console.log("Adding Organization");
var view = new AddOrganizationView();
Application.
trigger('showSidebar', view);
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment