Skip to content

Instantly share code, notes, and snippets.

@shohey1226
Created June 15, 2013 05:20
Show Gist options
  • Save shohey1226/5787007 to your computer and use it in GitHub Desktop.
Save shohey1226/5787007 to your computer and use it in GitHub Desktop.
app.routers.AppRouter = Backbone.Router.extend({
routes: {
"": "home",
"employees/:id": "employeeDetails",
"employees/:id/reports": "reports",
"employees/:id/map": "map"
},
initialize: function () {
app.slider = new PageSlider($('body'));
},
home: function () {
// Since the home view never changes, we instantiate it and render it only once
if (!app.homeView) {
app.homeView = new app.views.HomeView();
app.homeView.render();
} else {
console.log('reusing home view');
app.homeView.delegateEvents(); // delegate events when the view is recycled
}
app.slider.slidePage(app.homeView.$el);
},
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment