redirect to post show on create
This commit is contained in:
parent
9b02633dff
commit
6098890783
2 changed files with 14 additions and 0 deletions
|
|
@ -17,6 +17,7 @@ app.pages.Framer = app.views.Base.extend({
|
||||||
this.model.authorIsCurrentUser = function(){ return true }
|
this.model.authorIsCurrentUser = function(){ return true }
|
||||||
|
|
||||||
this.model.bind("change", this.render, this)
|
this.model.bind("change", this.render, this)
|
||||||
|
this.model.bind("sync", this.navigateToShow, this)
|
||||||
this.templatePicker = new app.views.TemplatePicker({ model: this.model })
|
this.templatePicker = new app.views.TemplatePicker({ model: this.model })
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
@ -24,6 +25,10 @@ app.pages.Framer = app.views.Base.extend({
|
||||||
return app.views.Post.showFactory(this.model)
|
return app.views.Post.showFactory(this.model)
|
||||||
},
|
},
|
||||||
|
|
||||||
|
navigateToShow : function(){
|
||||||
|
app.router.navigate(this.model.url(), {trigger: true, replace: true})
|
||||||
|
},
|
||||||
|
|
||||||
saveFrame : function(){
|
saveFrame : function(){
|
||||||
this.model.save()
|
this.model.save()
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -23,5 +23,14 @@ describe("app.pages.Framer", function(){
|
||||||
this.page.$("button.done").click();
|
this.page.$("button.done").click();
|
||||||
expect(app.frame.save).toHaveBeenCalled();
|
expect(app.frame.save).toHaveBeenCalled();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it("navigates on save", function(){
|
||||||
|
spyOn(app.router, "navigate")
|
||||||
|
this.page.model.set({id : 22})
|
||||||
|
this.page.model.trigger("sync")
|
||||||
|
|
||||||
|
console.log(app.router.navigate)
|
||||||
|
expect(app.router.navigate).toHaveBeenCalled()
|
||||||
|
})
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue