Skip to content

Instantly share code, notes, and snippets.

@kraftwer1
Created September 6, 2012 15:23
Show Gist options
  • Save kraftwer1/3657308 to your computer and use it in GitHub Desktop.
Save kraftwer1/3657308 to your computer and use it in GitHub Desktop.
Mobile.Router = Em.Router.extend
enableLogging: true
location: "history"
root: Em.Route.extend
index: Em.Route.extend
route: "/"
articles: Em.Route.extend
# Example URL: /articles/501b7878b19fb834f900005d
route: "/articles"
showArticle: Em.Route.transitionTo("show")
index: Em.Route.extend
route: "/"
connectOutlets: (router) ->
router.get("applicationController").connectOutlet(
"articles", Mobile.Article.find()
)
show: Em.Route.extend
route: "/:article_id"
connectOutlets: (router, article) ->
router.get("applicationController").connectOutlet(
"article", article
)
# Rewrite URL (make sure /:article_id is not being overwritten with null)
serialize: (router, article) ->
article_id: article.get("_id")
# deserialize: (router, params) ->
# Mobile.Article.find(params.article_id)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment