Fix a couple of station podcast bugs

This commit is contained in:
Duncan Sommerville 2015-11-03 17:13:38 -05:00
parent a1d9902b2a
commit 6683b712c4
4 changed files with 24 additions and 7 deletions

View File

@ -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();

View File

@ -84,7 +84,7 @@
</button>
</div>
<div class='btn-group pull-right'>
<button ng-click="saveStationPodcast()" class="btn" title='<?php echo _("Save station podcast") ?>' type="button">
<button ng-click="savePodcast()" class="btn" title='<?php echo _("Save station podcast") ?>' type="button">
<?php echo _("Save") ?>
</button>
</div>

View File

@ -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 () {

View File

@ -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);
}