35 lines
913 B
CoffeeScript
35 lines
913 B
CoffeeScript
context = window
|
|
logger = context.JK.logger
|
|
|
|
@TeacherStudentLevel = React.createClass({
|
|
|
|
mixens: [ICheckMixin]
|
|
|
|
componentDidMount: () ->
|
|
@checkboxes = [{selector: 'input.slot-decision', stateKey: 'slot-decision'}]
|
|
|
|
@root = $(@getDOMNode())
|
|
|
|
@iCheckify()
|
|
|
|
componentDidUpdate: () ->
|
|
|
|
@iCheckify()
|
|
|
|
render: () ->
|
|
`<span>
|
|
<input objectName={this.props.student} type="checkbox" className="student-level" onChange={this.studentLevelChanged.bind(this, this.props.student)} checked={this.state.checked}/>
|
|
<span className="student-level">{this.props.display}</span>
|
|
</span>`
|
|
|
|
studentLevelChanged: (level, e) ->
|
|
@setState({checked: $(e.target).is(':checked') })
|
|
|
|
@props.onChange(this.props.student, $(e.target).is(':checked'))
|
|
|
|
getInitialState: () ->
|
|
{checked:@props.level}
|
|
|
|
componentWillReceiveProps: (nextProps) ->
|
|
@setState({checked: nextProps.level})
|
|
}) |