Skip to content

Commit

Permalink
Add a basic class for defining routes for models.
Browse files Browse the repository at this point in the history
  • Loading branch information
towerhe committed Oct 18, 2014
1 parent 2b72113 commit 65141a0
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions app/routes/model.coffee
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
`import Ember from 'ember'`

ModelRoute = Ember.Route.extend
typeKey: undefined
formLegend: undefined

model: (params) -> @store.find(@typeKey, params["#{@typeKey}_id"])

setupController: (controller, model) ->
controller.set('formLegend', @formLegend) if @formLegend

@_super(controller, model)

actions:
willTransition: ->
@get('controller').send('revertChanges')

`export default ModelRoute`

0 comments on commit 65141a0

Please sign in to comment.