summaryrefslogtreecommitdiff
path: root/www/js/musicpools.js
diff options
context:
space:
mode:
authorPeterTheOne <petertheone@gmail.com>2016-01-28 20:29:46 (GMT)
committerPeterTheOne <petertheone@gmail.com>2016-01-28 20:29:46 (GMT)
commita3d085734454a66955bcc2c642b0a4f7bf5d2b92 (patch)
treed290b36b2eb96d6350ec31e02e2a9e2f0c93b14c /www/js/musicpools.js
parent7aa6781c617b91e3ed28d528428087f11131daac (diff)
fix musicgrid bugs, create Rivendell.Group class, refactor
Diffstat (limited to 'www/js/musicpools.js')
-rw-r--r--www/js/musicpools.js28
1 files changed, 16 insertions, 12 deletions
diff --git a/www/js/musicpools.js b/www/js/musicpools.js
index ec5f864..abb6679 100644
--- a/www/js/musicpools.js
+++ b/www/js/musicpools.js
@@ -22,6 +22,8 @@
'use strict';
+var Rivendell = Rivendell || {};
+
var rivendell = null;
var importer = null;
var musicpoolsView = null;
@@ -32,7 +34,7 @@ function musicpools_init() {
importer = new Rivendell.Importer();
- var musicpools = new Rivendell.GroupList(rivendell, 'musicpool');
+ var musicpools = new Rivendell.GroupList(rivendell);
musicpoolsView = new MusicpoolsView(musicpools);
}
@@ -48,7 +50,7 @@ var MusicpoolsView = function(model) {
this.currentPoolId = sessionStorage.getItem('currentPoolId');
var self = this;
- this.model.fetch(function() {
+ this.model.fetch('musicpool', function() {
self.updateSelector();
});
};
@@ -102,21 +104,23 @@ MusicpoolsView.prototype.updateSelector = function() {
};
// this and jinglegroup are basicly the same thing
-var Musicpool = function(title, clock, groupName, description, lowcart, highcart, normlevel, trimlevel) {
- this.title = title;
- this.clock = clock;
-
- this.groupName = groupName;
- this.description = description;
- this.lowcart = lowcart;
- this.highcart = highcart;
- this.normlevel = normlevel;
- this.trimlevel = trimlevel;
+var Musicpool = function(groupName, description, lowcart, highcart, normlevel, trimlevel, title, clock) {
+ if (arguments.length === 1) {
+ Rivendell.Group.call(this, groupName);
+ this.title = $('musicpool-title', this.groupXml).text();
+ this.clock = $('musicpool-clock', this.groupXml).text();
+ } else {
+ Rivendell.Group.call(this, groupName, description, lowcart, highcart, normlevel, trimlevel);
+ this.title = title;
+ this.clock = clock;
+ }
this.carts = [];
this.$el = null;
};
+Musicpool.prototype = Object.create(Rivendell.Group.prototype);
+Musicpool.prototype.constructor = Musicpool;
Musicpool.prototype.render = function() {
var self = this;