From e2fe6d4284e9fdc2453ec29ea3ab524978760352 Mon Sep 17 00:00:00 2001 From: denise Date: Fri, 17 Aug 2012 12:56:45 -0400 Subject: [PATCH] CC-4243: Playlist Builder: Remove main fade block if there are no fades to set -fixed --- .../views/scripts/playlist/playlist.phtml | 8 +++++++ airtime_mvc/public/js/airtime/library/spl.js | 22 ++++++++++++++++--- .../airtime/playlist/smart_playlistbuilder.js | 10 --------- 3 files changed, 27 insertions(+), 13 deletions(-) diff --git a/airtime_mvc/application/views/scripts/playlist/playlist.phtml b/airtime_mvc/application/views/scripts/playlist/playlist.phtml index 70ce2faea..0034dc71f 100644 --- a/airtime_mvc/application/views/scripts/playlist/playlist.phtml +++ b/airtime_mvc/application/views/scripts/playlist/playlist.phtml @@ -2,14 +2,22 @@ if (isset($this->obj)) { $contents = $this->obj->getContents(); $count = count($contents); + $displayFades = true; + if ($count > 0) { + if ($contents[0]['type'] == 2 && $contents[$count-1]['type'] == 2) { + $displayFades = false; + } + } } ?> obj)) : ?> + "> Playlist crossfade + obj)) : ?> diff --git a/airtime_mvc/public/js/airtime/library/spl.js b/airtime_mvc/public/js/airtime/library/spl.js index 2ca4e4732..f20b03091 100644 --- a/airtime_mvc/public/js/airtime/library/spl.js +++ b/airtime_mvc/public/js/airtime/library/spl.js @@ -311,11 +311,25 @@ var AIRTIME = (function(AIRTIME){ } function setFadeIcon(){ + var contents = $("#spl_sortable"); + var show = contents.is(":visible"); var empty = $(".spl_empty"); - if (empty.length > 0) { + + if (!show || empty.length > 0) { $("#spl_crossfade").hide(); } else { - $("#spl_crossfade").show(); + //get list of playlist contents + var list = contents.children(); + + //if first and last items are blocks, hide the fade icon + var first = list.first(); + var last = list.last(); + if (first.find(':first-child').children().attr('blockid') !== undefined && + last.find(':first-child').children().attr('blockid') !== undefined) { + $("#spl_crossfade").hide(); + } else { + $("#spl_crossfade").show(); + } } } @@ -468,7 +482,9 @@ var AIRTIME = (function(AIRTIME){ fadeOut.show(); fadeOut.empty().append(json.fadeOut); } - $pl.find("#crossfade_main").show(); + if (json.fadeIn != null || json.fadeOut != null) { + $pl.find("#crossfade_main").show(); + } } }); } diff --git a/airtime_mvc/public/js/airtime/playlist/smart_playlistbuilder.js b/airtime_mvc/public/js/airtime/playlist/smart_playlistbuilder.js index dc667f90c..ccb2492ba 100644 --- a/airtime_mvc/public/js/airtime/playlist/smart_playlistbuilder.js +++ b/airtime_mvc/public/js/airtime/playlist/smart_playlistbuilder.js @@ -239,16 +239,6 @@ function getRowIndex(ele) { return index; } -function setFadeIcon(){ - var contents = $("#spl_sortable"); - var show = contents.is(":visible"); - if (show) { - $("#spl_crossfade").show(); - } else { - $("#spl_crossfade").hide(); - } -} - /* This function appends a '+' button for the last * modifier row of each criteria. * If there are no modifier rows, the '+' button