fix for bug

This commit is contained in:
Seth Call 2016-06-24 15:25:36 -05:00
parent 0f9c02f5f1
commit 526b11e0d1
2 changed files with 43 additions and 36 deletions

View File

@ -10,48 +10,55 @@ teacherActions = window.JK.Actions.Teacher
@setCheckboxState()
@enableICheck()
setSingleCheckbox: (checkbox) ->
selector = checkbox.selector
if checkbox.stateKey?
choice = @state[checkbox.stateKey]
else
choice = @props[checkbox.propsKey]
$candidate = @root.find(selector)
@iCheckIgnore = true
if $candidate.attr('type') == 'radio'
if choice?
$found = @root.find(selector + '[value="' + choice + '"]')
$found.iCheck('check').attr('checked', true)
else
$candidate.iCheck('uncheck').attr('checked', false)
else
if choice
$candidate.iCheck('check').attr('checked', true);
else
$candidate.iCheck('uncheck').attr('checked', false);
@iCheckIgnore = false
setCheckboxState: () ->
for checkbox in @checkboxes
selector = checkbox.selector
for checkbox in this.checkboxes
@setSingleCheckbox(checkbox)
if checkbox.stateKey?
choice = @state[checkbox.stateKey]
else
choice = @props[checkbox.propsKey]
enableSingle: (checkbox) ->
selector = checkbox.selector
$candidate = @root.find(selector)
checkBoxes = @root.find(selector + '[type="checkbox"]')
if checkBoxes.length > 0
context.JK.checkbox(checkBoxes)
checkBoxes.on('ifChanged', (e) => @checkIfCanFire(e))
radioBoxes = @root.find(selector + '[type="radio"]')
if radioBoxes.length > 0
context.JK.checkbox(radioBoxes)
radioBoxes.on('ifChanged', (e) => @checkIfCanFire(e))
@iCheckIgnore = true
if $candidate.attr('type') == 'radio'
if choice?
$found = @root.find(selector + '[value="' + choice + '"]')
$found.iCheck('check').attr('checked', true)
else
$candidate.iCheck('uncheck').attr('checked', false)
else
if choice
$candidate.iCheck('check').attr('checked', true);
else
$candidate.iCheck('uncheck').attr('checked', false);
@iCheckIgnore = false
enableICheck: (e) ->
if !@root?
return
for checkbox in @checkboxes
selector = checkbox.selector
checkBoxes = @root.find(selector + '[type="checkbox"]')
if checkBoxes.length > 0
context.JK.checkbox(checkBoxes)
checkBoxes.on('ifChanged', (e) => @checkIfCanFire(e))
radioBoxes = @root.find(selector + '[type="radio"]')
if radioBoxes.length > 0
context.JK.checkbox(radioBoxes)
radioBoxes.on('ifChanged', (e) => @checkIfCanFire(e))
for checkbox in this.checkboxes
@enableSingle(checkbox)
true

View File

@ -28,7 +28,7 @@ logger = context.JK.logger
if @pairedJamBlaster? && @pairedJamBlaster.tracks?
logger.debug("onUpdateAudio name=#{name} value=#{value}", @pairedJamBlaster.tracks)
audio = jQuery({}, @pairedJamBlaster.tracks)
audio = $.extend({}, @pairedJamBlaster.tracks)
if name == 'inputTypeTrack1'
audio.input1_linemode = value
else if name == 'inputTypeTrack2'
@ -52,8 +52,8 @@ logger = context.JK.logger
if name == 'combined'
combined = value
track1Instrument = audio.track1Instrument
track2Instrument = audio.track2Instrument
track1Instrument = @pairedJamBlaster.tracks.track1Instrument
track2Instrument = @pairedJamBlaster.tracks.track2Instrument
if name == 'track1Instrument'
track1Instrument = @convertToClientInstrument(value)
if name == 'track2Instrument'