context = window rest = context.JK.Rest() TeacherSearchActions = @TeacherSearchActions LocationActions = @LocationActions @TeacherSearchOptionsScreen = React.createClass({ mixins: [ICheckMixin, Reflux.listenTo(@AppStore, "onAppInit"), Reflux.listenTo(@UserStore, "onUserChanged"), Reflux.listenTo(@TeacherSearchStore, "onTeacherSearchChanged")] LIMIT: 20 componentDidMount: () -> @checkboxes = [ {selector: 'input.onlyMySchool', stateKey: 'onlyMySchool'}, {selector: 'input.beginner-level', stateKey: 'beginner-level'}, {selector: 'input.intermediate-level', stateKey: 'intermediate-level'}, {selector: 'input.advanced-level', stateKey: 'advanced-level'}] @root = $(@getDOMNode()) @iCheckify() componentDidUpdate: () -> @iCheckify() getInitialState: () -> {onlyMySchool: true, options: {onlyMySchool: true}} onAppInit: (@app) -> @app.bindScreen('jamclass/searchOptions', {beforeShow: @beforeShow, afterShow: @afterShow}) beforeShow: (e) -> LocationActions.load() afterShow: (e) -> onUserChanged: (@user) -> @setState(user: @user?.user) onTeacherSearchChanged: (options) -> @setState({onlyMySchool: options.onlyMySchool, options: options}) handleListChange: (listName, selectedObjects)-> logger.debug("handleListChange:", listName, selectedObjects) options = @state.options options[listName] = selectedObjects @setState({options: options}) handleLocationChange: (country, region) -> logger.debug("handleLocationChange #{country} #{region}") options = @state.options options['location'] = {country:country, region:region} @setState({options: options}) onCancel: (e) -> e.preventDefault() window.history.go(-1) onSearch: (e) -> e.preventDefault() logger.debug("teacher search options", @state.options) TeacherSearchActions.search(@state.options) levelChanged: (e) -> purpose = $(e.target).attr('data-purpose') checked = $(e.target).is(":checked") logger.debug("levelChanged:", purpose, checked) options = @state.options options[purpose] = checked @setState({options: options}) handleYearsTeaching: (e) -> yearsTeaching = $(e.target).val() options = @state.options options['years-teaching'] = yearsTeaching @setState({options: options}) onlyMySchoolChange: (e) -> $target = $(e.target) checked = $target.is(':checked') options = @state.options options.onlyMySchool = checked @setState({options: options, onlyMySchool: checked}) checkboxChanged: (e) -> $target = $(e.target) if $target.is('.onlyMySchool') state = {} state['onlyMySchool'] = $target.is(':checked') @setState(state) @onlyMySchoolChange(e) else state = {} state[$target.attr('name')] = $target.is(':checked') @setState(state) @levelChanged(e) render: () -> if @state.user?.school_id? && !@state.user?['is_guitar_center?'] onlySchoolOption = `

School Options

` selectedAge = null yearsTeaching = [] for yr in [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 15, 20, 25, 30, 40, 45, 50] yearsTeaching.push(``) `

search teachers

Instruments Taught:

Music Subjects Taught:

Genres Taught:

Languages Spoken:


Student Levels Taught:

Student Ages Taught:

Years Teaching Experience:

{onlySchoolOption}
CANCEL SEARCH
` })