redirect to post show on create

This commit is contained in:
danielgrippi 2012-04-04 17:33:28 -07:00
parent 9b02633dff
commit 6098890783
2 changed files with 14 additions and 0 deletions

View file

@ -17,6 +17,7 @@ app.pages.Framer = app.views.Base.extend({
this.model.authorIsCurrentUser = function(){ return true }
this.model.bind("change", this.render, this)
this.model.bind("sync", this.navigateToShow, this)
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)
},
navigateToShow : function(){
app.router.navigate(this.model.url(), {trigger: true, replace: true})
},
saveFrame : function(){
this.model.save()
}

View file

@ -23,5 +23,14 @@ describe("app.pages.Framer", function(){
this.page.$("button.done").click();
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()
})
});
});