1
0
mirror of https://github.com/2ec0b4/kaamelott-soundboard.git synced 2025-12-09 16:05:35 +00:00

Révise la récupération des données avec une Radio

This commit is contained in:
Antoine
2016-04-09 17:47:11 +02:00
parent 0c84cd6968
commit 2202364489
7 changed files with 80 additions and 9 deletions

View File

@@ -2,10 +2,11 @@ define(
'views/sounds',
[
'marionette',
'jquery',
'backbone.radio',
'underscore',
'hbs!templates/sounds'
],
function (Marionette, $, SoundListTemplate) {
function (Marionette, Radio, _, SoundListTemplate) {
"use strict";
var SoundListView = Marionette.LayoutView.extend({
@@ -15,10 +16,12 @@ define(
this.data = {};
$.get('/sounds/sounds.json', function(json) {
that.data.sounds = json;
that.render();
});
this.channel = Radio.channel('Sounds');
this.channel.request('getSounds')
.then(function (sounds) {
that.data.sounds = sounds;
that.render();
});
},
serializeData: function () {
var viewData = {data: this.data};