1
0
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:
Antoine
2016-04-10 23:43:09 +02:00
parent a25e921055
commit 36935c6c80
6 changed files with 57 additions and 38 deletions

31
js/app/views/sound.js Normal file
View 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;
});