diff --git a/public/javascripts/app/router.js b/public/javascripts/app/router.js index 4111062a9..736128730 100644 --- a/public/javascripts/app/router.js +++ b/public/javascripts/app/router.js @@ -14,8 +14,8 @@ app.Router = Backbone.Router.extend({ "u/:name": "stream", "followed_tags": "stream", "tags/:name": "stream", - "posts/:id": "stream", - "p/:id": "stream" + "posts/:id": "singlePost", + "p/:id": "singlePost" }, stream : function() { @@ -27,6 +27,18 @@ app.Router = Backbone.Router.extend({ $("#main_stream").html(app.page.el); $('#selected_aspect_contacts .content').html(streamFacesView.el); + }, + + singlePost : function(id) { + new app.models.Post({id : id}).fetch({success : function(resp){ + var postAttrs = resp.get("posts"); + + var view = new app.views.Post({ + model : new app.models.Post(postAttrs) + }).render(); + + $("#main_stream").html(view.el); + }}) } });