SAAS-1188 - add empty placeholder for podcast episodes table
This commit is contained in:
parent
26c9a19836
commit
0951afcbb3
|
@ -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) {
|
mod.drawEmptyPlaceholder = function (table) {
|
||||||
var emptyRow = table.find('tr:has(td.dataTables_empty)'),
|
var emptyRow = table.find('tr:has(td.dataTables_empty)'),
|
||||||
|
@ -82,18 +83,26 @@ var AIRTIME = (function(AIRTIME) {
|
||||||
emptyRow.hide();
|
emptyRow.hide();
|
||||||
var mediaType = parseInt($('.media_type_selector.selected').data('selection-id')),
|
var mediaType = parseInt($('.media_type_selector.selected').data('selection-id')),
|
||||||
img = wrapper.find('.empty_placeholder_image');
|
img = wrapper.find('.empty_placeholder_image');
|
||||||
|
if (isNaN(mediaType)) { return; }
|
||||||
// Remove all classes for when we change between empty media types
|
// Remove all classes for when we change between empty media types
|
||||||
img.removeClass(function() {
|
img.removeClass(function() { return $(this).attr("class"); });
|
||||||
return $(this).attr("class");
|
|
||||||
});
|
|
||||||
|
|
||||||
var opts = AIRTIME.library.placeholder(mediaType);
|
if (table[0] == AIRTIME.library.podcastEpisodeDataTable[0]) {
|
||||||
img.addClass("empty_placeholder_image icon-white " + opts.icon);
|
img.addClass("empty_placeholder_image icon-white icon-th-list");
|
||||||
wrapper.find('.empty_placeholder_text').html(
|
wrapper.find('.empty_placeholder_text').html(
|
||||||
$.i18n._("You haven't added any " + opts.media + ".")
|
$.i18n._("This podcast doesn't have any episodes!")
|
||||||
+ "<br/>" + $.i18n._(opts.subtext)
|
+ "<br/>" + $.i18n._("Make sure the RSS feed contains audio items (with enclosure tags).")
|
||||||
+ "<br/><a target='_blank' href='" + opts.href + "'>" + $.i18n._("Learn about " + opts.media) + "</a>"
|
+ "<br/><a target='_blank' href='http://www.apple.com/ca/itunes/podcasts/specs.html'>" + $.i18n._("Learn about podcasts") + "</a>"
|
||||||
);
|
);
|
||||||
|
} 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 + ".")
|
||||||
|
+ "<br/>" + $.i18n._(opts.subtext)
|
||||||
|
+ "<br/><a target='_blank' href='" + opts.href + "'>" + $.i18n._("Learn about " + opts.media) + "</a>"
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
libEmpty.show();
|
libEmpty.show();
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -1558,6 +1558,9 @@ var AIRTIME = (function(AIRTIME) {
|
||||||
},
|
},
|
||||||
oColReorder: {
|
oColReorder: {
|
||||||
iFixedColumns: 3 // Checkbox + imported
|
iFixedColumns: 3 // Checkbox + imported
|
||||||
|
},
|
||||||
|
fnDrawCallback: function () {
|
||||||
|
AIRTIME.library.drawEmptyPlaceholder($(this));
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
buttons,
|
buttons,
|
||||||
|
|
|
@ -341,12 +341,13 @@ var AIRTIME = (function (AIRTIME) {
|
||||||
* @private
|
* @private
|
||||||
*/
|
*/
|
||||||
PodcastEpisodeTable.prototype._datatablesCheckboxDataDelegate = function(rowData, callType, dataToSave) {
|
PodcastEpisodeTable.prototype._datatablesCheckboxDataDelegate = function(rowData, callType, dataToSave) {
|
||||||
var importIcon = "<span class='sp-checked-icon checked-icon imported-flag'></span>",
|
var defaultIcon = "<span class='icon-white icon-import'></span>",
|
||||||
|
importIcon = "<span class='sp-checked-icon checked-icon imported-flag'></span>",
|
||||||
pendingIcon = "<span class='loading-icon'></span>";
|
pendingIcon = "<span class='loading-icon'></span>";
|
||||||
if (this.config.hideIngestCheckboxes && rowData.ingested && rowData.ingested != 0) {
|
if (this.config.hideIngestCheckboxes && rowData.ingested && rowData.ingested != 0) {
|
||||||
return rowData.ingested > 0 ? importIcon : pendingIcon;
|
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);
|
return AIRTIME.widgets.Table.prototype._datatablesCheckboxDataDelegate.call(this, rowData, callType, dataToSave);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -368,10 +369,8 @@ var AIRTIME = (function (AIRTIME) {
|
||||||
applyPlatformOpacityRules: false
|
applyPlatformOpacityRules: false
|
||||||
});
|
});
|
||||||
$.get(endpoint + self.config.podcastId + '/episodes', function (json) {
|
$.get(endpoint + self.config.podcastId + '/episodes', function (json) {
|
||||||
dt.fnClearTable();
|
dt.fnClearTable(false);
|
||||||
self.clearSelection();
|
|
||||||
dt.fnAddData(JSON.parse(json));
|
dt.fnAddData(JSON.parse(json));
|
||||||
// dt.fnDraw();
|
|
||||||
}).done(function () {
|
}).done(function () {
|
||||||
dt.unblock();
|
dt.unblock();
|
||||||
});
|
});
|
||||||
|
@ -417,7 +416,7 @@ var AIRTIME = (function (AIRTIME) {
|
||||||
if (delta) { // Has there been a change?
|
if (delta) { // Has there been a change?
|
||||||
// We already have the data, so there's no reason to call
|
// We already have the data, so there's no reason to call
|
||||||
// reload() here; this also provides a smoother transition
|
// reload() here; this also provides a smoother transition
|
||||||
dt.fnClearTable();
|
dt.fnClearTable(false);
|
||||||
dt.fnAddData(data);
|
dt.fnAddData(data);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue