From 32713ba6fbe7edaeec888a3d64e7cbf16ff547b7 Mon Sep 17 00:00:00 2001 From: Jon Bergli Heier Date: Mon, 5 Mar 2012 23:04:03 +0100 Subject: Fixed playlist storage. --- static/playlist.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/static/playlist.js b/static/playlist.js index 1de78fa..99ec6c5 100644 --- a/static/playlist.js +++ b/static/playlist.js @@ -29,7 +29,9 @@ $(function(){ initialize: function() { items.bind('add', this.addOne, this); items.bind('remove', this.removeOne, this); + items.bind('reset', this.addAll, this); this.current = null; + items.fetch(); }, add: function(item) { var model = items.create(item); @@ -43,6 +45,10 @@ $(function(){ }, removeOne: function(item) { $('#playlist #cid-' + item.cid).remove(); + item.destroy(); + }, + addAll: function() { + items.each(this.addOne); }, next: function() { var item = items.at(0); -- cgit v1.2.3