From a1a7396ec9ad3c28d3ae7221cb26157aff059c94 Mon Sep 17 00:00:00 2001 From: denise Date: Tue, 6 Nov 2012 14:29:26 -0500 Subject: [PATCH] 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 --- .../library/events/library_playlistbuilder.js | 12 +++++++++--- .../public/js/airtime/playlist/smart_blockbuilder.js | 3 ++- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/airtime_mvc/public/js/airtime/library/events/library_playlistbuilder.js b/airtime_mvc/public/js/airtime/library/events/library_playlistbuilder.js index fd9851f33..937342217 100644 --- a/airtime_mvc/public/js/airtime/library/events/library_playlistbuilder.js +++ b/airtime_mvc/public/js/airtime/library/events/library_playlistbuilder.js @@ -8,10 +8,16 @@ var AIRTIME = (function(AIRTIME) { mod = AIRTIME.library; mod.checkAddButton = function() { - var selected = mod.getChosenItemsLength(), sortable = $('#spl_sortable'), check = false; - // make sure audioclips are selected and a playlist is currently open. - if (selected !== 0 && sortable.length !== 0) { + var selected = mod.getChosenItemsLength(), + 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; } diff --git a/airtime_mvc/public/js/airtime/playlist/smart_blockbuilder.js b/airtime_mvc/public/js/airtime/playlist/smart_blockbuilder.js index c33ccc351..94f40b4a8 100644 --- a/airtime_mvc/public/js/airtime/playlist/smart_blockbuilder.js +++ b/airtime_mvc/public/js/airtime/playlist/smart_blockbuilder.js @@ -201,7 +201,8 @@ function setSmartBlockEvents() { /********** CHANGE PLAYLIST TYPE **********/ form.find('dd[id="sp_type-element"]').live("change", function(){ - setupUI(); + setupUI(); + AIRTIME.library.checkAddButton(); }); /********** CRITERIA CHANGE **********/