Skip to content

Instantly share code, notes, and snippets.

@yaoquan
Created August 4, 2012 12:54
Show Gist options
  • Select an option

  • Save yaoquan/3257530 to your computer and use it in GitHub Desktop.

Select an option

Save yaoquan/3257530 to your computer and use it in GitHub Desktop.
Joosy.namespace 'CompetencyUnits', ->
class @IndexPage extends ApplicationPage
@layout ApplicationLayout
@view 'index'
@fetch (complete) ->
CompetencyUnit.find 'all', (competency_units) =>
@data.competency_units = competency_units
@data.selectedCu = @data.competency_units.data[0]
complete()
editCu: (id) ->
CompetencyUnit.find id, (selectedCu) =>
Joosy.Application.page.data.selectedCu.load selectedCu
Joosy.Router.map
404 : (path) -> alert "Page '#{path}' was not found"
'/' : -> @navigate '/competency_units'
'/competency_units' :
'/' : CompetencyUnits.IndexPage
'/:id' : (params) -> Joosy.Application.page.editCu params.id
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment