Refresh podcast tabs on focus to have better synchronization with auto-ingest backend
This commit is contained in:
parent
e8643e04eb
commit
05f51a9a2d
|
@ -180,7 +180,7 @@ class Rest_PodcastController extends Zend_Rest_Controller
|
||||||
case HttpRequestType::GET:
|
case HttpRequestType::GET:
|
||||||
foreach($ids as $id) {
|
foreach($ids as $id) {
|
||||||
// TODO: This should use the same code path as the GET action.
|
// TODO: This should use the same code path as the GET action.
|
||||||
// It essentially does, except for the randering of the tab layout.
|
// It essentially does, except for the rendering of the tab layout.
|
||||||
// That said, not every GET is going to need the page rendered...
|
// That said, not every GET is going to need the page rendered...
|
||||||
// Where should the rendering code for the podcast tabs go? -- Duncan
|
// Where should the rendering code for the podcast tabs go? -- Duncan
|
||||||
$responseBody[] = Application_Service_PodcastService::buildPodcastEditorResponse($id, $this->view);
|
$responseBody[] = Application_Service_PodcastService::buildPodcastEditorResponse($id, $this->view);
|
||||||
|
|
|
@ -23,6 +23,17 @@ var AIRTIME = (function (AIRTIME) {
|
||||||
tab.contents.find("table").attr("id", "podcast_episodes_" + podcast.id);
|
tab.contents.find("table").attr("id", "podcast_episodes_" + podcast.id);
|
||||||
var episodeTable = AIRTIME.podcast.initPodcastEpisodeDatatable(podcast.episodes, tab);
|
var episodeTable = AIRTIME.podcast.initPodcastEpisodeDatatable(podcast.episodes, tab);
|
||||||
|
|
||||||
|
// Override the switchTo function to reload the table when the tab is focused.
|
||||||
|
// Should help to reduce the number of cases where the frontend doesn't match the state
|
||||||
|
// of the backend (due to automatic ingestion).
|
||||||
|
// Note that these cases should already be very few and far between.
|
||||||
|
// TODO: make sure this doesn't noticeably slow performance
|
||||||
|
// XXX: it's entirely possible that this (in the angular app) is not where we want this function...
|
||||||
|
tab.switchTo = function() {
|
||||||
|
AIRTIME.tabs.Tab.prototype.switchTo.call(this);
|
||||||
|
episodeTable.reload($scope.podcast.id);
|
||||||
|
};
|
||||||
|
|
||||||
function updatePodcast() {
|
function updatePodcast() {
|
||||||
$http.put(endpoint + $scope.podcast.id, { csrf_token: $scope.csrf, podcast: $scope.podcast })
|
$http.put(endpoint + $scope.podcast.id, { csrf_token: $scope.csrf, podcast: $scope.podcast })
|
||||||
.success(function() {
|
.success(function() {
|
||||||
|
@ -193,7 +204,8 @@ var AIRTIME = (function (AIRTIME) {
|
||||||
'iFixedColumns': 1 // Checkbox
|
'iFixedColumns': 1 // Checkbox
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
}
|
||||||
|
);
|
||||||
|
|
||||||
podcastEpisodesTableWidget.getDatatable().addTitles("td");
|
podcastEpisodesTableWidget.getDatatable().addTitles("td");
|
||||||
return podcastEpisodesTableWidget;
|
return podcastEpisodesTableWidget;
|
||||||
|
|
|
@ -327,6 +327,13 @@ var AIRTIME = (function(AIRTIME){
|
||||||
$("#show_builder_table_wrapper").css("top", h + 5);
|
$("#show_builder_table_wrapper").css("top", h + 5);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Expose the Tab object so it can be subclassed
|
||||||
|
*
|
||||||
|
* @type {Function}
|
||||||
|
*/
|
||||||
|
mod.Tab = Tab;
|
||||||
|
|
||||||
return AIRTIME;
|
return AIRTIME;
|
||||||
|
|
||||||
}(AIRTIME || {}));
|
}(AIRTIME || {}));
|
||||||
|
|
Loading…
Reference in New Issue