39 lines
743 B
CoffeeScript
39 lines
743 B
CoffeeScript
$ = jQuery
|
|
context = window
|
|
logger = context.JK.logger
|
|
rest = context.JK.Rest()
|
|
|
|
TeacherSearchActions = @TeacherSearchActions
|
|
|
|
@TeacherSearchStore = Reflux.createStore(
|
|
{
|
|
listenables: TeacherSearchActions
|
|
searchOptions: {onlyMySchool: true}
|
|
viewingTeacher: null
|
|
|
|
init: ->
|
|
# Register with the app store to get @app
|
|
this.listenTo(context.AppStore, this.onAppInit)
|
|
|
|
|
|
onAppInit: (app) ->
|
|
@app = app
|
|
|
|
onUpdateOptions: (options) ->
|
|
@searchOptions = options
|
|
|
|
onSearch: (searchOptions) ->
|
|
|
|
@searchOptions = searchOptions
|
|
|
|
@changed()
|
|
|
|
window.location = "/client#/teachers/search"
|
|
|
|
getState: () ->
|
|
@searchOptions || {}
|
|
|
|
changed:() ->
|
|
@trigger(@getState())
|
|
}
|
|
) |