Remove station podcast from podcast datatable; editor now opens from button in podcasts view

This commit is contained in:
Duncan Sommerville 2015-10-29 12:17:52 -04:00
parent 8c49477b9c
commit 4b11979eff
5 changed files with 49 additions and 16 deletions

View File

@ -120,6 +120,7 @@ class LocaleController extends Zend_Controller_Action
"Input must be a number" => _("Input must be a number"),
"Input must be in the format: yyyy-mm-dd" => _("Input must be in the format: yyyy-mm-dd"),
"Input must be in the format: hh:mm:ss.t" => _("Input must be in the format: hh:mm:ss.t"),
"My Station Podcast" => _("My Station Podcast"),
//library/plupload.js
"You are currently uploading files. %sGoing to another screen will cancel the upload process. %sAre you sure you want to leave the page?"
=> _("You are currently uploading files. %sGoing to another screen will cancel the upload process. %sAre you sure you want to leave the page?"),

View File

@ -23,6 +23,16 @@ class Rest_Bootstrap extends Zend_Application_Module_Bootstrap
);
$router->addRoute('podcast-bulk', $podcastBulkRoute);
$stationPodcastRoute = new Zend_Controller_Router_Route(
'rest/podcast/station',
array(
'controller' => 'podcast',
'action' => 'station',
'module' => 'rest'
)
);
$router->addRoute('station-podcast', $stationPodcastRoute);
$route = new Rest_RouteController($front,
'rest/podcast/:id/episodes',
array(

View File

@ -27,7 +27,9 @@ class Rest_PodcastController extends Zend_Rest_Controller
$sortColumn = $this->_getParam('sort', PodcastPeer::ID);
$sortDir = $this->_getParam('sort_dir', Criteria::ASC);
// Don't return the Station podcast - we fetch it separately
$query = PodcastQuery::create()
->filterByDbId(Application_Model_Preference::getStationPodcastId(), Criteria::NOT_EQUAL)
->setLimit($limit)
->setOffset($offset)
->orderBy($sortColumn, $sortDir);
@ -173,17 +175,13 @@ class Rest_PodcastController extends Zend_Rest_Controller
foreach($ids as $id) {
Application_Service_PodcastService::deletePodcastById($id);
}
// XXX: do we need this to be more descriptive?
// Should we even bother passing back a response message here?
$responseBody = "Successfully deleted podcasts";
break;
case HttpRequestType::GET:
foreach($ids as $id) {
// TODO: This should use the same code path as the GET action.
// It essentially does, except for the rendering of the tab layout.
// That said, not every GET is going to need the page rendered...
// Where should the rendering code for the podcast tabs go? -- Duncan
$responseBody[] = Application_Service_PodcastService::buildPodcastEditorResponse($id, $this->view);
$responseBody[] = array(
"podcast" => Application_Service_PodcastService::getPodcastById($id),
"html" => $this->view->render('podcast/podcast.phtml')
);
}
break;
}
@ -191,6 +189,17 @@ class Rest_PodcastController extends Zend_Rest_Controller
$this->_helper->json->sendJson($responseBody);
}
public function stationAction() {
$stationPodcastId = Application_Model_Preference::getStationPodcastId();
$podcast = Application_Service_PodcastService::getPodcastById($stationPodcastId);
$path = 'podcast/station_podcast.phtml';
$this->view->podcast = $podcast;
$this->_helper->json->sendJson(array(
"podcast" => json_encode($podcast),
"html" => $this->view->render($path),
));
}
private function getId()
{
if (!$id = $this->_getParam('id', false)) {

View File

@ -1277,14 +1277,18 @@ var AIRTIME = (function(AIRTIME) {
var podcastToolbarButtons = AIRTIME.widgets.Table.getStandardToolbarButtons();
podcastToolbarButtons[AIRTIME.widgets.Table.TOOLBAR_BUTTON_ROLES.NEW].title = $.i18n._('Add'); //"New" Podcast is misleading
podcastToolbarButtons[AIRTIME.widgets.Table.TOOLBAR_BUTTON_ROLES.NEW].eventHandlers.click = function(e) {
AIRTIME.podcast.createUrlDialog();
};
podcastToolbarButtons[AIRTIME.widgets.Table.TOOLBAR_BUTTON_ROLES.EDIT].eventHandlers.click = function(e) {
AIRTIME.podcast.editSelectedPodcasts();
};
podcastToolbarButtons[AIRTIME.widgets.Table.TOOLBAR_BUTTON_ROLES.DELETE].eventHandlers.click = function(e) {
AIRTIME.podcast.deleteSelectedPodcasts();
podcastToolbarButtons[AIRTIME.widgets.Table.TOOLBAR_BUTTON_ROLES.NEW].eventHandlers.click = AIRTIME.podcast.createUrlDialog;
podcastToolbarButtons[AIRTIME.widgets.Table.TOOLBAR_BUTTON_ROLES.EDIT].eventHandlers.click = AIRTIME.podcast.editSelectedPodcasts;
podcastToolbarButtons[AIRTIME.widgets.Table.TOOLBAR_BUTTON_ROLES.DELETE].eventHandlers.click = AIRTIME.podcast.deleteSelectedPodcasts;
// Add a button to view the station podcast
podcastToolbarButtons["StationPodcast"] = {
'title' : $.i18n._("My Station Podcast"),
'iconClass' : "icon-music",
extraBtnClass : "",
elementId : "",
eventHandlers : {
click: AIRTIME.podcast.openStationPodcast
}
};
//Set up the div with id "podcast_table" as a datatable.

View File

@ -216,6 +216,15 @@ var AIRTIME = (function (AIRTIME) {
});
};
/**
* Open a tab to view and edit the station podcast
*/
mod.openStationPodcast = function() {
$.get(endpoint + 'station', function(json) {
_initAppFromResponse(json);
})
};
/**
* Create a bulk request to edit all currently selected podcasts.
*/