CC-4243: Playlist Builder: Remove main fade block if there are no fades to set

-fixed
This commit is contained in:
denise 2012-08-17 12:56:45 -04:00
parent d473190a8c
commit e2fe6d4284
3 changed files with 27 additions and 13 deletions
airtime_mvc
application/views/scripts/playlist
public/js/airtime

View File

@ -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;
}
}
}
?>
<button id="spl_new" class="ui-button ui-widget ui-state-default" role="button" aria-disabled="false">New</button>
<?php if (isset($this->obj)) : ?>
<button id="spl_delete" class="ui-button ui-widget ui-state-default" role="button" aria-disabled="false">Delete</button>
<?php if ($displayFades) :?>
<a href="#" id="spl_crossfade" class="ui-button ui-button-icon-only ui-widget ui-state-default crossfade-main-button" style="display:<?php echo $count > 0 ?"block;":"none;"?>">
<span class="ui-icon crossfade-main-icon"></span><span class="ui-button-text">Playlist crossfade</span>
</a>
<?php endif; ?>
<?php endif; ?>
<?php if (isset($this->obj)) : ?>

View File

@ -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();
}
}
});
}

View File

@ -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