From 6683b712c4f97e0d29b6883cb15460b91b898e30 Mon Sep 17 00:00:00 2001 From: Duncan Sommerville Date: Tue, 3 Nov 2015 17:13:38 -0500 Subject: [PATCH] Fix a couple of station podcast bugs --- .../application/services/PodcastService.php | 5 ++++- .../scripts/podcast/station_podcast.phtml | 2 +- .../public/js/airtime/library/podcast.js | 21 +++++++++++++++---- .../public/js/airtime/showbuilder/tabs.js | 3 ++- 4 files changed, 24 insertions(+), 7 deletions(-) diff --git a/airtime_mvc/application/services/PodcastService.php b/airtime_mvc/application/services/PodcastService.php index 1d015dc2a..81f07bc54 100644 --- a/airtime_mvc/application/services/PodcastService.php +++ b/airtime_mvc/application/services/PodcastService.php @@ -228,7 +228,9 @@ class Application_Service_PodcastService throw new PodcastNotFoundException(); } - return $podcast->toArray(BasePeer::TYPE_FIELDNAME); + $podcast = $podcast->toArray(BasePeer::TYPE_FIELDNAME); + $podcast["itunes_explicit"] = ($podcast["itunes_explicit"] == "yes") ? true : false; + return $podcast; } /** @@ -297,6 +299,7 @@ class Application_Service_PodcastService self::_updateAutoIngestTimestamp($podcast, $data); } + $data["podcast"]["itunes_explicit"] = $data["podcast"]["itunes_explicit"] ? "yes" : "clean"; $podcast->fromArray($data["podcast"], BasePeer::TYPE_FIELDNAME); $podcast->save(); diff --git a/airtime_mvc/application/views/scripts/podcast/station_podcast.phtml b/airtime_mvc/application/views/scripts/podcast/station_podcast.phtml index cb32e806b..120622e7e 100644 --- a/airtime_mvc/application/views/scripts/podcast/station_podcast.phtml +++ b/airtime_mvc/application/views/scripts/podcast/station_podcast.phtml @@ -84,7 +84,7 @@
-
diff --git a/airtime_mvc/public/js/airtime/library/podcast.js b/airtime_mvc/public/js/airtime/library/podcast.js index 16295e3b9..4bb9e0a04 100644 --- a/airtime_mvc/public/js/airtime/library/podcast.js +++ b/airtime_mvc/public/js/airtime/library/podcast.js @@ -54,7 +54,7 @@ var AIRTIME = (function (AIRTIME) { * * @private */ - function _updatePodcast() { + self._updatePodcast = function () { $http.put(endpoint + $scope.podcast.id, {csrf_token: $scope.csrf, podcast: $scope.podcast}) .success(function () { // episodeTable.reload($scope.podcast.id); @@ -62,7 +62,7 @@ var AIRTIME = (function (AIRTIME) { AIRTIME.library.podcastDataTable.fnDraw(); tab.setName($scope.podcast.title); }); - } + }; /** * For imported podcasts. @@ -78,7 +78,7 @@ var AIRTIME = (function (AIRTIME) { episode: this }); }); - _updatePodcast(); + self._updatePodcast(); }; /** @@ -157,15 +157,28 @@ var AIRTIME = (function (AIRTIME) { function StationPodcastController($scope, $http, podcast, tab) { // Super call to parent controller var self = PodcastController.call(this, $scope, $http, podcast, tab); + // Store the station podcast tab in module scope so it can be checked if the user clicks the + // Station Podcast button again - this way we don't have to go back to the server to get the ID. $stationPodcastTab = tab; + /** + * Override the tab close function to 'unset' the module-scope $stationPodcastTab + * + * @override + */ + tab.close = function () { + AIRTIME.tabs.Tab.prototype.close.call(this); + $stationPodcastTab = undefined; + }; + + /** * For the station podcast. * * Update the station podcast object. */ $scope.savePodcast = function () { - _updatePodcast(); + self._updatePodcast(); }; $scope.deleteSelectedEpisodes = function () { diff --git a/airtime_mvc/public/js/airtime/showbuilder/tabs.js b/airtime_mvc/public/js/airtime/showbuilder/tabs.js index d67d0cc69..fcfd33ff4 100644 --- a/airtime_mvc/public/js/airtime/showbuilder/tabs.js +++ b/airtime_mvc/public/js/airtime/showbuilder/tabs.js @@ -265,7 +265,7 @@ var AIRTIME = (function(AIRTIME){ * Initialize the singleton ScheduleTab object on startup */ mod.initScheduleTab = function() { - $scheduleTab = Object.freeze(new ScheduleTab()); + $scheduleTab = new ScheduleTab(); $activeTab = $scheduleTab; }; @@ -298,6 +298,7 @@ var AIRTIME = (function(AIRTIME){ mod.updateActiveTab = function() { var t = $(".nav.nav-tabs .active"); $activeTab = mod.get(t.data("tab-id")); + if (!$activeTab) $activeTab = $scheduleTab; if ($activeTab.contents.hasClass("pl-content")) { AIRTIME.playlist.setCurrent($activeTab.contents); }