From dc101335c8b629f6f244a7fc88fa74bc4e88a9fd Mon Sep 17 00:00:00 2001 From: Christian Pointner Date: Thu, 8 Sep 2016 16:34:26 +0200 Subject: honor evergreen flag on jingles cuts diff --git a/www/js/jingles.js b/www/js/jingles.js index 78c2675..2a269cd 100644 --- a/www/js/jingles.js +++ b/www/js/jingles.js @@ -189,7 +189,13 @@ Rdxport.JingleCartView = function(model, groupView, active) { var self = this; if (this.model) { - $(this.model.cuts).each(function(index, cut) { + $(this.model.cuts).sort(function(a, b) { + if(a.isEvergreen == b.isEvergreen) + return 0; + if(a.isEvergreen) + return 1; + return -1; + }).each(function(index, cut) { cut.active = self.active; var cutView = new Rdxport.JingleCutView(cut); @@ -239,7 +245,11 @@ Rdxport.JingleCutView.prototype.render = function() { var activateButton; if (this.model.active) { activateButton = $(''); - status.addClass('label-success').html(''); + if (!this.model.isEvergreen) { + status.addClass('label-success').html(''); + } else { + status.addClass('label-info').html(''); + } } else { activateButton = $(''); status.addClass('label-warning').html(''); diff --git a/www/js/rdxport.js b/www/js/rdxport.js index 44198ed..64dbf51 100644 --- a/www/js/rdxport.js +++ b/www/js/rdxport.js @@ -506,7 +506,7 @@ Rdxport.Cart.prototype.removeCut = function(cut) { }; Rdxport.Cut = function(name, description, cart, length, originDatetime, - playCounter, lastPlayDatetime) { + playCounter, lastPlayDatetime, isEvergreen) { this.xml = null; if (arguments.length === 2) { @@ -518,6 +518,7 @@ Rdxport.Cut = function(name, description, cart, length, originDatetime, this.playCounter = $('playCounter', this.xml).text(); this.lastPlayDatetime = new Date(new Date($('lastPlayDatetime', this.xml).text()) - 5000); // playout-server live 5s in the future this.cart = arguments[1]; + this.isEvergreen = ($('evergreen', this.xml).text().toLowerCase() == "true"); } else { this.name = name; this.description = description; @@ -526,6 +527,7 @@ Rdxport.Cut = function(name, description, cart, length, originDatetime, this.originDatetime = new Date(originDatetime); this.playCounter = playCounter; this.lastPlayDatetime = new Date(new Date(lastPlayDatetime) - 5000); // playout-server live 5s in the future + this.isEvergreen = isEvergreen } this.number = this.name.substr(-3); this.cartNumber = this.cart.number; -- cgit v0.10.2