mirror of
https://github.com/2ec0b4/kaamelott-soundboard.git
synced 2025-12-10 16:35:34 +00:00
Révise la gestion des sons via une CollectionView
This commit is contained in:
31
js/app/views/sound.js
Normal file
31
js/app/views/sound.js
Normal file
@@ -0,0 +1,31 @@
|
||||
define(
|
||||
'views/sound',
|
||||
[
|
||||
'marionette',
|
||||
'models/sound',
|
||||
'hbs!templates/sound'
|
||||
],
|
||||
function (Marionette, SoundModel, SoundBlockTemplate) {
|
||||
"use strict";
|
||||
|
||||
var SoundBlockView = Marionette.ItemView.extend({
|
||||
template: SoundBlockTemplate,
|
||||
model: SoundModel,
|
||||
tagName: 'li',
|
||||
ui: {
|
||||
soundItem: 'a'
|
||||
},
|
||||
events: {
|
||||
'click @ui.soundItem': 'playSound'
|
||||
},
|
||||
playSound: function(e) {
|
||||
e.preventDefault();
|
||||
|
||||
this.trigger('sound:play');
|
||||
|
||||
this.model.play();
|
||||
}
|
||||
});
|
||||
|
||||
return SoundBlockView;
|
||||
});
|
||||
Reference in New Issue
Block a user