CC-4455: "Add to current smart block" context menu action should be disabled for dynamic smart blocks

-disabled this button in the library toolbar if dynamic blocks are open
This commit is contained in:
denise 2012-11-06 14:29:26 -05:00
parent e262d48eec
commit a1a7396ec9
2 changed files with 11 additions and 4 deletions

View File

@ -8,10 +8,16 @@ var AIRTIME = (function(AIRTIME) {
mod = AIRTIME.library; mod = AIRTIME.library;
mod.checkAddButton = function() { mod.checkAddButton = function() {
var selected = mod.getChosenItemsLength(), sortable = $('#spl_sortable'), check = false;
// make sure audioclips are selected and a playlist is currently open. var selected = mod.getChosenItemsLength(),
if (selected !== 0 && sortable.length !== 0) { sortable = $('#spl_sortable:visible'),
check = false,
blockType = $('input[name=sp_type]:checked', '#smart-block-form').val();
// make sure audioclips are selected and a playlist or static block is currently open.
// static blocks have value of 0
// dynamic blocks have value of 1
if (selected !== 0 && (sortable.length !== 0 || blockType === "0")) {
check = true; check = true;
} }

View File

@ -201,7 +201,8 @@ function setSmartBlockEvents() {
/********** CHANGE PLAYLIST TYPE **********/ /********** CHANGE PLAYLIST TYPE **********/
form.find('dd[id="sp_type-element"]').live("change", function(){ form.find('dd[id="sp_type-element"]').live("change", function(){
setupUI(); setupUI();
AIRTIME.library.checkAddButton();
}); });
/********** CRITERIA CHANGE **********/ /********** CRITERIA CHANGE **********/