-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
efb07e3
commit 652c876
Showing
6 changed files
with
188 additions
and
184 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,8 @@ | ||
define([ | ||
'core/js/adapt', | ||
'./textEntryAudioView', | ||
'core/js/models/componentModel' | ||
], function(Adapt, TextEntryAudioView, ComponentModel) { | ||
|
||
return Adapt.register('textEntry-audio', { | ||
view: TextEntryAudioView, | ||
model: ComponentModel.extend({}) | ||
}); | ||
import Adapt from 'core/js/adapt'; | ||
import TextEntryAudioModel from './textEntryAudioModel'; | ||
import TextEntryAudioView from './textEntryAudioView'; | ||
|
||
export default Adapt.register('textEntry-audio', { | ||
model: TextEntryAudioModel, | ||
view: TextEntryAudioView | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
import ComponentModel from 'core/js/models/componentModel'; | ||
|
||
export default class TextEntryAudioModel extends ComponentModel {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,44 +1,47 @@ | ||
define([ | ||
'core/js/adapt' | ||
], function(Adapt) { | ||
'use strict'; | ||
import Adapt from 'core/js/adapt'; | ||
|
||
var TextEntryAudioPopupView = Backbone.View.extend({ | ||
class TextEntryAudioPopupView extends Backbone.View { | ||
|
||
className: 'textEntry-audio-popup-content', | ||
className() { | ||
return 'textEntry-audio-popup-content'; | ||
} | ||
|
||
events: { | ||
'click .textEntry-close-button': 'closePopup' | ||
}, | ||
events() { | ||
return { | ||
'click .textEntry-close-button': 'closePopup' | ||
}; | ||
} | ||
|
||
initialize: function() { | ||
this.listenToOnce(Adapt, 'notify:opened', this.onOpened); | ||
this.render(); | ||
}, | ||
initialize(...args) { | ||
super.initialize(...args); | ||
|
||
onOpened: function() { | ||
this.playAudio(); | ||
}, | ||
this.listenToOnce(Adapt, 'notify:opened', this.onOpened); | ||
this.render(); | ||
} | ||
|
||
render: function() { | ||
var data = this.model.toJSON(); | ||
var template = Handlebars.templates['textEntryAudioPopup']; | ||
this.$el.html(template(data)); | ||
}, | ||
onOpened() { | ||
this.playAudio(); | ||
} | ||
|
||
closePopup: function(event) { | ||
Adapt.trigger('notify:close'); | ||
}, | ||
render() { | ||
const data = this.model.toJSON(); | ||
data.view = this; | ||
const template = Handlebars.templates[this.constructor.template]; | ||
this.$el.html(template(data)); | ||
} | ||
|
||
playAudio: function() { | ||
if (Adapt.audio && this.model.has('_audio') && this.model.get('_audio')._isEnabled && Adapt.audio.audioClip[this.model.get('_audio')._channel].status==1) { | ||
Adapt.audio.audioClip[this.model.get('_audio')._channel].onscreenID = ""; | ||
Adapt.trigger('audio:playAudio', this.model.get("_feedback")._audio.src, this.model.get('_id'), this.model.get('_audio')._channel); | ||
} | ||
} | ||
closePopup(event) { | ||
Adapt.trigger('notify:close'); | ||
} | ||
|
||
}); | ||
playAudio() { | ||
if (Adapt.audio && this.model.has('_audio') && this.model.get('_audio')._isEnabled && Adapt.audio.audioClip[this.model.get('_audio')._channel].status==1) { | ||
Adapt.audio.audioClip[this.model.get('_audio')._channel].onscreenID = ""; | ||
Adapt.trigger('audio:playAudio', this.model.get("_feedback")._audio.src, this.model.get('_id'), this.model.get('_audio')._channel); | ||
} | ||
} | ||
} | ||
|
||
return TextEntryAudioPopupView; | ||
TextEntryAudioPopupView.template = 'textEntryAudioPopup'; | ||
|
||
}); | ||
export default TextEntryAudioPopupView; |
Oops, something went wrong.