diff --git a/airtime_mvc/public/js/airtime/library/events/library_showbuilder.js b/airtime_mvc/public/js/airtime/library/events/library_showbuilder.js index 7c9389b88..a2938d0ef 100644 --- a/airtime_mvc/public/js/airtime/library/events/library_showbuilder.js +++ b/airtime_mvc/public/js/airtime/library/events/library_showbuilder.js @@ -70,8 +70,9 @@ var AIRTIME = (function(AIRTIME) { }; /** + * Draw a placeholder for the given table to show if it has no data. * - * @param {jQuery} table + * @param {jQuery} table jQuery object containing the table DOM node */ mod.drawEmptyPlaceholder = function (table) { var emptyRow = table.find('tr:has(td.dataTables_empty)'), @@ -82,18 +83,26 @@ var AIRTIME = (function(AIRTIME) { emptyRow.hide(); var mediaType = parseInt($('.media_type_selector.selected').data('selection-id')), img = wrapper.find('.empty_placeholder_image'); + if (isNaN(mediaType)) { return; } // Remove all classes for when we change between empty media types - img.removeClass(function() { - return $(this).attr("class"); - }); + img.removeClass(function() { return $(this).attr("class"); }); - var opts = AIRTIME.library.placeholder(mediaType); - img.addClass("empty_placeholder_image icon-white " + opts.icon); - wrapper.find('.empty_placeholder_text').html( - $.i18n._("You haven't added any " + opts.media + ".") - + "
" + $.i18n._(opts.subtext) - + "
" + $.i18n._("Learn about " + opts.media) + "" - ); + if (table[0] == AIRTIME.library.podcastEpisodeDataTable[0]) { + img.addClass("empty_placeholder_image icon-white icon-th-list"); + wrapper.find('.empty_placeholder_text').html( + $.i18n._("This podcast doesn't have any episodes!") + + "
" + $.i18n._("Make sure the RSS feed contains audio items (with enclosure tags).") + + "
" + $.i18n._("Learn about podcasts") + "" + ); + } else { + var opts = AIRTIME.library.placeholder(mediaType); + img.addClass("empty_placeholder_image icon-white " + opts.icon); + wrapper.find('.empty_placeholder_text').html( + $.i18n._("You haven't added any " + opts.media + ".") + + "
" + $.i18n._(opts.subtext) + + "
" + $.i18n._("Learn about " + opts.media) + "" + ); + } libEmpty.show(); } else { diff --git a/airtime_mvc/public/js/airtime/library/library.js b/airtime_mvc/public/js/airtime/library/library.js index 0773e8c1c..9b0d75c94 100644 --- a/airtime_mvc/public/js/airtime/library/library.js +++ b/airtime_mvc/public/js/airtime/library/library.js @@ -1558,6 +1558,9 @@ var AIRTIME = (function(AIRTIME) { }, oColReorder: { iFixedColumns: 3 // Checkbox + imported + }, + fnDrawCallback: function () { + AIRTIME.library.drawEmptyPlaceholder($(this)); } }, buttons, diff --git a/airtime_mvc/public/js/airtime/library/podcast.js b/airtime_mvc/public/js/airtime/library/podcast.js index e1c9d6a14..8a3ea8e42 100644 --- a/airtime_mvc/public/js/airtime/library/podcast.js +++ b/airtime_mvc/public/js/airtime/library/podcast.js @@ -341,12 +341,13 @@ var AIRTIME = (function (AIRTIME) { * @private */ PodcastEpisodeTable.prototype._datatablesCheckboxDataDelegate = function(rowData, callType, dataToSave) { - var importIcon = "", + var defaultIcon = "", + importIcon = "", pendingIcon = ""; if (this.config.hideIngestCheckboxes && rowData.ingested && rowData.ingested != 0) { return rowData.ingested > 0 ? importIcon : pendingIcon; } - rowData.importIcon = (rowData.ingested != 0) ? (rowData.ingested > 0 ? importIcon : pendingIcon) : null; + rowData.importIcon = (rowData.ingested != 0) ? (rowData.ingested > 0 ? importIcon : pendingIcon) : defaultIcon; return AIRTIME.widgets.Table.prototype._datatablesCheckboxDataDelegate.call(this, rowData, callType, dataToSave); }; @@ -368,10 +369,8 @@ var AIRTIME = (function (AIRTIME) { applyPlatformOpacityRules: false }); $.get(endpoint + self.config.podcastId + '/episodes', function (json) { - dt.fnClearTable(); - self.clearSelection(); + dt.fnClearTable(false); dt.fnAddData(JSON.parse(json)); - // dt.fnDraw(); }).done(function () { dt.unblock(); }); @@ -417,7 +416,7 @@ var AIRTIME = (function (AIRTIME) { if (delta) { // Has there been a change? // We already have the data, so there's no reason to call // reload() here; this also provides a smoother transition - dt.fnClearTable(); + dt.fnClearTable(false); dt.fnAddData(data); } });