From 6e712b4b82b2e2a0cdda705375675952d6bb4f5a Mon Sep 17 00:00:00 2001 From: Lucas Bickel Date: Tue, 21 Mar 2017 00:18:22 +0100 Subject: [PATCH 1/2] Hideable Scheduled Shows tab Makes the first tab remoeable and the tracks page be full width after removing the last tab. You can press the "Dashboard" link to open it back up again. --- .../views/scripts/showbuilder/index.phtml | 3 +- airtime_mvc/public/css/dashboard.css | 2 +- airtime_mvc/public/js/airtime/library/spl.js | 23 +++++----- .../js/airtime/showbuilder/main_builder.js | 6 +++ .../public/js/airtime/showbuilder/tabs.js | 44 ++++++++++++++++--- 5 files changed, 61 insertions(+), 17 deletions(-) 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..9e5c3058c 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: 140px; 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 * From 4a7d5be735a1a119b780429dd218cec083743bc6 Mon Sep 17 00:00:00 2001 From: Lucas Bickel Date: Thu, 23 Mar 2017 14:12:58 +0100 Subject: [PATCH 2/2] Wider max-width for more browser compat --- airtime_mvc/public/css/dashboard.css | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/airtime_mvc/public/css/dashboard.css b/airtime_mvc/public/css/dashboard.css index 9e5c3058c..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: 140px; + max-width: 160px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis;