I’d like to implement a Pinterest style modal page for items (images/items/posts/etc…). Whichever page you are on, when you click on a item a modal with the item details pops up, and the page (feed) where you are from still sits in the background. The url in the address bar changes so you can link to the item from other sites or share it to your friends. And when you close the item modal your still at the feed.
Does Ember support this type of routing?
I know react-router has support for it, so I imagine Ember would as well as it is heavily inspired by Ember-router.
“The url /pictures/:id can potentially match two routes, it all depends on if the url was navigated to from the feed or not.”
“Click on an item in the feed, and see that it opens in an overlay. Then copy/paste it into a different browser window (Like Chrome → Firefox), and see that the image does not render inside the overlay. One URL, two session dependent routes and UI :D”
Hey Jason, it’s a little more complicated than a nested route. We need to hit: this.route('pin', { path: '/pin/:id' }); from any route and keep the previous screen behind the overlay. For example, showing the overlay on top of the home page OR from pinterest.com/[username] OR pinterest.com/[username]/[tag]
Not really sure how you can get the back button to restore state as in the modal appearing. Right now it restores state of of the “hardlink” URL (not sure that’s the proper term).
Edit: I noticed the backbutton doesn’t tear down the modal. I can fix that tomorrow but I guess one way would be to listen for hashchange or popstate depending on what location type you’re using.