Frontend polish and fixes; make empty placeholder implementation more abstract and add placeholder to 'My Podcast' view
This commit is contained in:
parent
0e74229975
commit
55df7775c2
10 changed files with 81 additions and 36 deletions
|
@ -72,30 +72,35 @@ var AIRTIME = (function(AIRTIME) {
|
|||
/**
|
||||
* Draw a placeholder for the given table to show if it has no data.
|
||||
*
|
||||
* @param {jQuery} table jQuery object containing the table DOM node
|
||||
* @param {Object} table jQuery object containing the table DOM node
|
||||
*/
|
||||
mod.drawEmptyPlaceholder = function (table) {
|
||||
var opts;
|
||||
if (table instanceof AIRTIME.widgets.Table) {
|
||||
opts = table.getEmptyPlaceholder();
|
||||
table = table.getDatatable();
|
||||
if (!table) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
var emptyRow = table.find('tr:has(td.dataTables_empty)'),
|
||||
wrapper = table.closest(".dataTables_wrapper");
|
||||
|
||||
var libEmpty = wrapper.find('.empty_placeholder');
|
||||
wrapper = table.closest(".dataTables_wrapper"),
|
||||
libEmpty = wrapper.find('.empty_placeholder');
|
||||
if (emptyRow.length > 0) {
|
||||
emptyRow.hide();
|
||||
var mediaType = parseInt($('.media_type_selector.selected').data('selection-id')),
|
||||
img = wrapper.find('.empty_placeholder_image');
|
||||
if (isNaN(mediaType)) { return; }
|
||||
if (isNaN(mediaType)) {
|
||||
return;
|
||||
}
|
||||
// Remove all classes for when we change between empty media types
|
||||
img.removeClass(function() { return $(this).attr("class"); });
|
||||
|
||||
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!")
|
||||
+ "<br/>" + $.i18n._("Make sure the RSS feed contains audio items (with enclosure tags).")
|
||||
+ "<br/><a target='_blank' href='http://www.apple.com/ca/itunes/podcasts/specs.html'>" + $.i18n._("Learn about podcasts") + "</a>"
|
||||
);
|
||||
if (opts) {
|
||||
img.addClass("empty_placeholder_image " + opts.iconClass);
|
||||
wrapper.find('.empty_placeholder_text').html(opts.html);
|
||||
} else {
|
||||
var opts = AIRTIME.library.placeholder(mediaType);
|
||||
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 + ".")
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue