diff options
Diffstat (limited to 'www/js/jingles.js')
-rw-r--r-- | www/js/jingles.js | 24 |
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; |