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

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