Skip to content

Instantly share code, notes, and snippets.

@cpjobling
Last active December 16, 2015 07:39
Show Gist options
  • Select an option

  • Save cpjobling/5400105 to your computer and use it in GitHub Desktop.

Select an option

Save cpjobling/5400105 to your computer and use it in GitHub Desktop.
Final Step: Small fix to allow "deep linking" from bookmarked project (e.g.http://localhost:3000/#/projects/3) to actual project. Also a small fix to correct bug in toggle styles
// Just a small addition to show method
AppRouter = Backbone.Router.extend({
// ...
show: function(id) {
// Seem to have to reconstruct HomeView to allow "deep-linking"
new HomeView();
this.toggleStyles(id);
project = projectList.get(id);
new ProjectView({model: project});
},
// ...
toggleStyles: function(e) {
$(".project.btn.btn-info").removeClass("btn-info");
$('a[href$="projects/' + e + '"]').addClass("btn-info");
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment