From 8468dfc2119248847582ba009bb9f9fbcbf42e70 Mon Sep 17 00:00:00 2001 From: Ramon Wijnands Date: Sun, 23 Nov 2014 14:20:35 +0000 Subject: [PATCH] add simple layout --- client/views/radios/radio.html | 34 +++++++++++++++++++++++++++++++++- client/views/radios/radio.js | 17 +++++++++++++++++ 2 files changed, 50 insertions(+), 1 deletion(-) create mode 100644 client/views/radios/radio.js diff --git a/client/views/radios/radio.html b/client/views/radios/radio.html index a6a4630..a1a1a4e 100644 --- a/client/views/radios/radio.html +++ b/client/views/radios/radio.html @@ -1,3 +1,35 @@ + + diff --git a/client/views/radios/radio.js b/client/views/radios/radio.js new file mode 100644 index 0000000..03f13ea --- /dev/null +++ b/client/views/radios/radio.js @@ -0,0 +1,17 @@ +Template.radio.helpers({ + radioSongs: function () { + var radioSongs = RadioSongs.find({radioId: this._id}).fetch(); + + _.each(radioSongs, function (rs) { + var songInfo = Songs.findOne({_id: rs.songId}); + + rs.votes = _.map(rs.votes, function (vote) { + return Meteor.users.findOne({_id: vote}); + }); + + rs.song = songInfo; + }); + + return radioSongs; + }, +});