Skip to content

Instantly share code, notes, and snippets.

@mattboldt
Created June 11, 2014 03:36
Show Gist options
  • Save mattboldt/60ae3b2086baa4633c97 to your computer and use it in GitHub Desktop.
Save mattboldt/60ae3b2086baa4633c97 to your computer and use it in GitHub Desktop.
App.Router.reopen
location: 'history'
rootURL: '/u/'
App.Router.map ->
@route 'login'
@resource('documents', path: '/')
@route('document', path: '/:document_id')
@resource('pages', path: '/:document_id/pages')
App.DocumentsRoute = Ember.Route.extend
model: ->
Ember.$.getJSON("/api/documents")
App.DocumentRoute = Ember.Route.extend
# model: (params) ->
# @store.find('document', params.document_id)
model: (params) ->
Ember.$.getJSON("/api/documents/#{params.document_id}")
# actions:
# loading: (transition, originRoute) ->
# true
App.NewDocumentRoute = Ember.Route.extend()
App.PageRoute = Ember.Route.extend
model: (params) ->
Ember.$.getJSON("/api/documents/#{params.document_id}/pages/#{params.page_id}")
App.PagesRoute = Ember.Route.extend
model: (params) ->
Ember.$.getJSON("/api/documents/#{params.document_id}/pages")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment