context = window teacherActions = window.JK.Actions.Teacher logger = context.JK.logger rest = window.JK.Rest() @TeacherSetupIntroduction = React.createClass({ mixins: [ @TeacherSetupMixin, Reflux.listenTo(@AppStore,"onAppInit"), Reflux.listenTo(TeacherStore, "onTeacherStateChanged") ] myBeforeShow: () -> setTimeout((() => $screen = @root.closest('.screen') $header = $screen.find('h2.edit-teacher-header') context.JK.HelpBubbleHelper.teacherProfile($header, $screen); ), 2000) screenName: () -> "introduction" getInitialState: () -> {} onTeacherStateChanged: (changes) -> $root = jQuery(this.getDOMNode()) logger.debug("onTeacherIntroStateChanged", changes, changes.errors?, changes.errors) unless this.handleErrors(changes) teacher = changes.teacher this.setState({ biography: teacher.biography, introductory_video: teacher.introductory_video, years_teaching: teacher.years_teaching, years_playing: teacher.years_playing, validate_introduction: true }) handleTextChange: (e) -> this.setState({"#{e.target.name}": e.target.value}) navDestination: (instructions) -> navTo=null if instructions? if instructions.direction=="cancel" || instructions.direction=="back" navTo = @teacherSetupSource() else if instructions.direction=="next" navTo = @teacherSetupDestination('basics') navTo handleNav: (e) -> navTo = this.navDestination(e) teacherActions.change.trigger(this.state, {navTo: navTo, instructions:e}) render: () -> `