diff --git a/airtime_mvc/application/views/scripts/showbuilder/index.phtml b/airtime_mvc/application/views/scripts/showbuilder/index.phtml index 2f5dfc8c3..9a8a4316d 100644 --- a/airtime_mvc/application/views/scripts/showbuilder/index.phtml +++ b/airtime_mvc/application/views/scripts/showbuilder/index.phtml @@ -23,9 +23,10 @@
diff --git a/airtime_mvc/public/css/dashboard.css b/airtime_mvc/public/css/dashboard.css index 8045c3979..f8e11c313 100644 --- a/airtime_mvc/public/css/dashboard.css +++ b/airtime_mvc/public/css/dashboard.css @@ -509,7 +509,7 @@ li.ui-state-default { .tab-name { float: left; - max-width: 120px; + max-width: 160px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; diff --git a/airtime_mvc/public/js/airtime/library/spl.js b/airtime_mvc/public/js/airtime/library/spl.js index 329e660f7..cc91366c3 100644 --- a/airtime_mvc/public/js/airtime/library/spl.js +++ b/airtime_mvc/public/js/airtime/library/spl.js @@ -855,17 +855,20 @@ var AIRTIME = (function(AIRTIME){ tab.close(); - $.ajax( { - url : baseUrl+"usersettings/set-library-screen-settings", - type : "POST", - data : { - settings : { - playlist : false + // save settings if we are not closing the "Scheduled Shows" tab + if (tabId != "0") { + $.ajax( { + url : baseUrl+"usersettings/set-library-screen-settings", + type : "POST", + data : { + settings : { + playlist : false + }, + format : "json" }, - format : "json" - }, - dataType : "json" - }); + dataType : "json" + }); + } }); $pl.find("#save_button").unbind().on("click", function(event) { diff --git a/airtime_mvc/public/js/airtime/showbuilder/main_builder.js b/airtime_mvc/public/js/airtime/showbuilder/main_builder.js index e63020e59..37f5fc62e 100644 --- a/airtime_mvc/public/js/airtime/showbuilder/main_builder.js +++ b/airtime_mvc/public/js/airtime/showbuilder/main_builder.js @@ -187,6 +187,12 @@ AIRTIME = (function(AIRTIME) { //Highlight the media type selector we're currently on. highlightMediaTypeSelector(); + // always re-show builder if dashboard button was clicked + $('.media_type_selector:first').on('click', function() { + $builder.show(); + AIRTIME.tabs.openScheduleTab(); + }); + /* * Icon hover states for search. */ diff --git a/airtime_mvc/public/js/airtime/showbuilder/tabs.js b/airtime_mvc/public/js/airtime/showbuilder/tabs.js index 6e0b0bd08..105dfae26 100644 --- a/airtime_mvc/public/js/airtime/showbuilder/tabs.js +++ b/airtime_mvc/public/js/airtime/showbuilder/tabs.js @@ -213,15 +213,26 @@ var AIRTIME = (function(AIRTIME){ delete $tabMap[self.id]; // Remove this tab from the internal tab mapping // Remove the relevant DOM elements (the tab and its contents) - self.tab.remove(); - self.contents.remove(); + if (self.uid !== 0) { + self.tab.remove(); + self.contents.remove(); + } else { + // only hide scheduled shows tab so we can still interact with it. + self.tab.hide(); + self.contents.hide(); + } - if (self.isActive()) { // Closing the current tab, otherwise we don't need to switch tabs + + if (self.isActive() && toTab) { // Closing the current tab, otherwise we don't need to switch tabs toTab.switchTo(); } else { mod.onResize(); } + if (Object.keys($openTabs).length < 1) { + $('#show_builder').hide(); + } + self._destroy(); }; @@ -259,6 +270,7 @@ var AIRTIME = (function(AIRTIME){ pane = $("#show_builder"), contents = pane.find(".outer-datatable-wrapper"); self.id = 0; + self.uid = uid; tab.data("tab-id", self.id); @@ -266,12 +278,16 @@ var AIRTIME = (function(AIRTIME){ self.contents = contents; self.tab = tab; - tab.on("click", function() { - if (!$(this).hasClass('active')) { + self.assignTabClickHandler(function(e) { + if (!self.isActive()) { self.switchTo(); } }); + self.assignTabCloseClickHandler(function(e) { + self.close(); + }); + $openTabs[uid] = self; $tabMap[self.id] = uid; }; @@ -305,11 +321,29 @@ var AIRTIME = (function(AIRTIME){ * @returns {Tab} the created Tab object */ mod.openTab = function(html, uid, callback) { + $('#show_builder').show(); var newTab = new Tab(html, uid); if (callback) callback(newTab); return newTab; }; + /** + * open the schedule tab if if was closed + * + * @returns {Tab} + */ + mod.openScheduleTab = function() { + var $scheduleTab = this.getScheduleTab(); + $('#show_builder').show(); + $openTabs[0] = $scheduleTab; + $scheduleTab.tab.show(); + $scheduleTab.contents.show(); + $scheduleTab.switchTo(); + $scheduleTab.assignTabCloseClickHandler(function(e) { + $scheduleTab.close(); + }); + }; + /** * Updates the currently active tab *