Skip to content

Commit

Permalink
Update js/ConfidenceSliderModel.js
Browse files Browse the repository at this point in the history
Co-authored-by: Oliver Foster <[email protected]>
  • Loading branch information
joe-allen-89 and oliverfoster authored Oct 27, 2023
1 parent c957d60 commit 907aa42
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions js/ConfidenceSliderModel.js
Original file line number Diff line number Diff line change
Expand Up @@ -115,17 +115,18 @@ export default class ConfidenceSliderModel extends SliderModel {
return feedbackString;
}

onLinkedSubmittedChanged(linkedModel) {
this.set('body', this.get('originalBody'));
this.set('_isEnabled', (linkedModel.get('_isSubmitted') === true));
this.set('_linkedModelSelectedIndex', linkedModel.get('_selectedItem').index);
updateFromLinkedModel() {
const isSubmitted = this.linkedModel.get('_isSubmitted');
this.set('body', isSubmitted ? this.get('originalBody') : this.get('disabledBody'));
this.set('_isEnabled', isSubmitted);
if (isSubmitted) {
this.set('_linkedModelSelectedIndex', this.linkedModel.get('_selectedItem').index);
}
this.checkCanSubmit();
}

_listenToLinkedModel() {
this.listenTo(this.linkedModel, {
'change:_isSubmitted': this.onLinkedSubmittedChanged
});
this.listenTo(this.linkedModel, 'change:_isSubmitted', this.updateFromLinkedModel);
}

_setupLinkedModel() {
Expand Down

0 comments on commit 907aa42

Please sign in to comment.