28 lines
558 B
CoffeeScript
28 lines
558 B
CoffeeScript
$ = jQuery
|
|
context = window
|
|
logger = context.JK.logger
|
|
|
|
@SubjectStore = Reflux.createStore(
|
|
{
|
|
listenables: @SubjectActions
|
|
subjects: []
|
|
subjectLookup: {}
|
|
|
|
init: ->
|
|
# Register with the app store to get @app
|
|
this.listenTo(context.AppStore, this.onAppInit)
|
|
|
|
onAppInit: (@app) ->
|
|
rest.getSubjects().done (subjects) =>
|
|
@subjects = subjects
|
|
for subject in subjects
|
|
@subjectLookup[subject.id] = subject.description
|
|
|
|
@trigger(@subjects)
|
|
|
|
display: (id) ->
|
|
@subjectLookup[id]
|
|
|
|
}
|
|
)
|