summaryrefslogtreecommitdiff
path: root/www/js/jingles.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/jingles.js
parent7aa6781c617b91e3ed28d528428087f11131daac (diff)
fix musicgrid bugs, create Rivendell.Group class, refactor
Diffstat (limited to 'www/js/jingles.js')
-rw-r--r--www/js/jingles.js24
1 files changed, 14 insertions, 10 deletions
diff --git a/www/js/jingles.js b/www/js/jingles.js
index a8bec1e..5c3c39a 100644
--- a/www/js/jingles.js
+++ b/www/js/jingles.js
@@ -22,6 +22,8 @@
'use strict';
+var Rivendell = Rivendell || {};
+
var rivendell = null;
var importer = null;
var groupList = null;
@@ -32,10 +34,10 @@ function jingles_init() {
importer = new Rivendell.Importer();
- groupList = new Rivendell.GroupList(rivendell, 'jingle');
+ groupList = new Rivendell.GroupList(rivendell);
// todo: move this elsewhere?
$('#app-jingles .groups').html('');
- groupList.fetch();
+ groupList.fetch('jingle');
}
function jingles_cleanup() {
@@ -47,14 +49,14 @@ function jingles_cleanup() {
rivendell = null;
}
-var JingleGroup = function(title, groupName, description, lowcart, highcart, normlevel, trimlevel) {
- this.title = title;
- this.groupName = groupName;
- this.description = description;
- this.lowcart = lowcart;
- this.highcart = highcart;
- this.normlevel = normlevel;
- this.trimlevel = trimlevel;
+var JingleGroup = function(groupName, description, lowcart, highcart, normlevel, trimlevel, title) {
+ if (arguments.length = 1) {
+ Rivendell.Group.call(this, groupName);
+ this.title = $('jingle-title', this.groupXml).text();
+ } else {
+ Rivendell.Group.call(this, groupName, description, lowcart, highcart, normlevel, trimlevel);
+ this.title = title;
+ }
this.mainCart = null;
this.deactivateCart = null;
@@ -64,6 +66,8 @@ var JingleGroup = function(title, groupName, description, lowcart, highcart, nor
this.render();
this.fetchCarts();
};
+JingleGroup.prototype = Object.create(Rivendell.Group.prototype);
+JingleGroup.prototype.constructor = JingleGroup;
JingleGroup.prototype.fetchCarts = function() {
var self = this;