remove next and previous functionality from router

This commit is contained in:
Fabian Rodriguez 2013-12-01 16:38:26 -02:00
parent d3f41a97c5
commit 6eed63807d

View file

@ -2,8 +2,6 @@ app.Router = Backbone.Router.extend({
routes: {
//new hotness
"posts/:id": "singlePost",
"posts/:id/next": "siblingPost",
"posts/:id/previous": "siblingPost",
"p/:id": "singlePost",
//oldness
@ -28,17 +26,6 @@ app.Router = Backbone.Router.extend({
this.renderPage(function(){ return new app.pages.SinglePostViewer({ id: id })});
},
siblingPost : function(){ //next or previous
var post = new app.models.Post();
post.bind("change", setPreloadAttributesAndNavigate)
post.fetch({url : window.location})
function setPreloadAttributesAndNavigate(){
window.gon.preloads.post = post.attributes
app.router.navigate(post.url(), {trigger:true, replace: true})
}
},
renderPage : function(pageConstructor){
app.page && app.page.unbind && app.page.unbind() //old page might mutate global events $(document).keypress, so unbind before creating
app.page = pageConstructor() //create new page after the world is clean (like that will ever happen)