Fix podcast table bug

This commit is contained in:
Duncan Sommerville 2015-11-16 12:44:57 -05:00
parent 64f62b1994
commit 130c5f570b
2 changed files with 25 additions and 38 deletions

View File

@ -1292,8 +1292,8 @@ var AIRTIME = (function(AIRTIME) {
/** /**
* Show the given table in the left-hand pane of the dashboard and give it internal focus * Show the given table in the left-hand pane of the dashboard and give it internal focus
* *
* @param {string} table the string name of the table to show * @param {string} table the string name of the table to show
* @param {boolean} [redraw] whether or not to redraw the table * @param {boolean} [redraw=true] whether or not to redraw the table
*/ */
mod.setCurrentTable = function (table, redraw) { mod.setCurrentTable = function (table, redraw) {
if (typeof redraw === 'undefined') { if (typeof redraw === 'undefined') {
@ -1346,11 +1346,10 @@ var AIRTIME = (function(AIRTIME) {
/* Website */ { "sTitle" : $.i18n._("Description") , "mDataProp" : "description" , "bVisible" : false , "sWidth" : "150px" }, /* Website */ { "sTitle" : $.i18n._("Description") , "mDataProp" : "description" , "bVisible" : false , "sWidth" : "150px" },
/* Year */ { "sTitle" : $.i18n._("Owner") , "mDataProp" : "owner" , "bVisible" : false , "sWidth" : "60px" }, /* Year */ { "sTitle" : $.i18n._("Owner") , "mDataProp" : "owner" , "bVisible" : false , "sWidth" : "60px" },
/* URL */ { "sTitle" : $.i18n._("Feed URL") , "mDataProp" : "url" , "bVisible" : false , "sWidth" : "60px" } /* URL */ { "sTitle" : $.i18n._("Feed URL") , "mDataProp" : "url" , "bVisible" : false , "sWidth" : "60px" }
],
ajaxSourceURL = baseUrl+"rest/podcast",
podcastToolbarButtons = AIRTIME.widgets.Table.getStandardToolbarButtons();
];
var ajaxSourceURL = baseUrl+"rest/podcast";
var podcastToolbarButtons = AIRTIME.widgets.Table.getStandardToolbarButtons();
$.extend(true, podcastToolbarButtons[AIRTIME.widgets.Table.TOOLBAR_BUTTON_ROLES.NEW], $.extend(true, podcastToolbarButtons[AIRTIME.widgets.Table.TOOLBAR_BUTTON_ROLES.NEW],
{ {
title: $.i18n._('Add'), //"New" Podcast is misleading title: $.i18n._('Add'), //"New" Podcast is misleading
@ -1404,20 +1403,6 @@ var AIRTIME = (function(AIRTIME) {
} }
}; };
// Add a button to view the station podcast
/* Moved to a separate top-level menu item
podcastToolbarButtons["StationPodcast"] = {
title : $.i18n._("My Podcast"),
iconClass : "icon-music",
extraBtnClass : "btn-small",
elementId : "",
eventHandlers : {
click: AIRTIME.podcast.openStationPodcast
},
validateConstraints: function () { return true; }
};
*/
//Set up the div with id "podcast_table" as a datatable. //Set up the div with id "podcast_table" as a datatable.
mod.podcastTableWidget = new AIRTIME.widgets.Table( mod.podcastTableWidget = new AIRTIME.widgets.Table(
$('#podcast_table'), //DOM node to create the table inside. $('#podcast_table'), //DOM node to create the table inside.
@ -1450,19 +1435,19 @@ var AIRTIME = (function(AIRTIME) {
*/ */
mod._initPodcastEpisodeDatatable = function () { mod._initPodcastEpisodeDatatable = function () {
var buttons = { var buttons = {
backBtn: { backBtn: {
title : $.i18n._('Back to Podcasts'), title : $.i18n._('Back to Podcasts'),
iconClass : 'icon-chevron-left', iconClass : 'icon-chevron-left',
extraBtnClass : 'btn-small', extraBtnClass : 'btn-small',
elementId : '', elementId : '',
eventHandlers : { eventHandlers : {
click: function () { click: function () {
mod.setCurrentTable(mod.DataTableTypeEnum.PODCAST); mod.setCurrentTable(mod.DataTableTypeEnum.PODCAST);
} }
}, },
validateConstraints: function () { return true; } validateConstraints: function () { return true; }
} }
}, },
defaults = AIRTIME.widgets.Table.getStandardToolbarButtons(); defaults = AIRTIME.widgets.Table.getStandardToolbarButtons();
/** /**
@ -1481,7 +1466,7 @@ var AIRTIME = (function(AIRTIME) {
$.each(selected, function () { $.each(selected, function () {
if (this.ingested < 0) isValid = false; if (this.ingested < 0) isValid = false;
var isImported = !$.isEmptyObject(this.file); var isImported = !$.isEmptyObject(this.file);
if ((!shouldBeImported && isImported) || (shouldBeImported && !isImported)) { if (shouldBeImported ? isImported : !isImported) {
isValid = false; isValid = false;
} }
}); });

View File

@ -94,9 +94,11 @@ var AIRTIME = (function(AIRTIME) {
"fnPreDrawCallback": function () { "fnPreDrawCallback": function () {
$("#draggingContainer").remove(); $("#draggingContainer").remove();
}, },
"fnServerData": self._fetchData "fnServerData": self._fetchData,
//"fnInitComplete" : function() { self._setupEventHandlers(bItemSelection) } //"fnInitComplete" : function() { self._setupEventHandlers(bItemSelection) }
//"fnDrawCallback" : self._tableDrawCallback "fnDrawCallback": function () {
self.clearSelection();
}
}; };
//Override any options with those passed in as arguments to this constructor. //Override any options with those passed in as arguments to this constructor.
@ -106,10 +108,10 @@ var AIRTIME = (function(AIRTIME) {
} }
if (options.fnCreatedRow) { if (options.fnCreatedRow) {
options.fnCreatedRow = options.fnCreatedRow.bind(this); options.fnCreatedRow = options.fnCreatedRow.bind(self);
} }
if (options.fnDrawCallback) { if (options.fnDrawCallback) {
options.fnDrawCallback = options.fnDrawCallback.bind(this); options.fnDrawCallback = options.fnDrawCallback.bind(self);
} }
self._datatable = self._$wrapperDOMNode.dataTable(options); self._datatable = self._$wrapperDOMNode.dataTable(options);