summaryrefslogtreecommitdiff
path: root/www/js/musicpools.js
diff options
context:
space:
mode:
Diffstat (limited to 'www/js/musicpools.js')
-rw-r--r--www/js/musicpools.js31
1 files changed, 5 insertions, 26 deletions
diff --git a/www/js/musicpools.js b/www/js/musicpools.js
index ce8e81a..2ccd27f 100644
--- a/www/js/musicpools.js
+++ b/www/js/musicpools.js
@@ -24,14 +24,10 @@
var Rivendell = Rivendell || {};
-var rivendell = null;
var importer = null;
var musicpoolsView = null;
function musicpools_init() {
- rivendell = new Rivendell.Rivendell(auth_username, auth_token, '/rd-bin/rdxport.cgi');
- rivendell.setListDropboxesEndpoint('/rh-bin/listdropboxes.cgi');
-
importer = new Rivendell.Importer();
var musicpools = new Rivendell.GroupList(rivendell);
@@ -51,13 +47,14 @@ Rivendell.MusicpoolsView = function(model) {
this.currentPoolId = sessionStorage.getItem('currentPoolId');
var self = this;
- this.model.fetch('musicpool', function() {
+ $(this.model).on('update', function() {
$(self.model.groups).each(function(index, musicpool) {
var musicpoolView = new Rivendell.MusicpoolView(musicpool);
self.musicpoolViews.push(musicpoolView);
});
self.updateSelector();
});
+ this.model.fetch('musicpool');
};
Rivendell.MusicpoolsView.prototype.setCurrentPoolId = function(currentPoolId) {
@@ -134,7 +131,7 @@ Rivendell.MusicpoolView = function(model) {
Rivendell.MusicpoolView.prototype.render = function() {
var self = this;
- this.model.fetchCarts(function() {
+ $(this.model).on('update', function() {
self.$el = $('#hiddenTemplates .musicpoolTemplate').clone().removeClass('musicpoolTemplate');
$('#app-musicpools .musicpoolContainer').html(self.$el);
@@ -143,29 +140,11 @@ Rivendell.MusicpoolView.prototype.render = function() {
// todo
/*$('.uploadButton', self.$el).on('click', function() {
- importer.showUploadModal(self.model);
+ importer.openModal(self.model);
});*/
});
-};
-
-Rivendell.Musicpool.prototype.fetchCarts = function(success) {
- var self = this;
- rivendell.listCarts(this.groupName, 1, function(cartsXml, status, req) {
- self.carts = [];
-
- var dbs = $('cartList', cartsXml).children();
- dbs.each(function(index, cartXml) {
- var cart = new Rivendell.Cart(cartXml, self);
-
- var cuts = $('cutList', cartXml).children();
- cart.cuts.push(new Rivendell.Cut(cuts[0], cart));
-
- self.carts.push(cart);
- });
-
- success();
- });
+ this.model.fetchCarts();
};
Rivendell.MusicpoolCutView = function(model) {