* SAAS-1184 - more polish for publishing/podcasting
* Fix some issues with the station podcast feed * Various small fixes
This commit is contained in:
parent
5264bebe57
commit
74f7c454b5
13 changed files with 257 additions and 50 deletions
|
@ -69,30 +69,27 @@ var AIRTIME = (function(AIRTIME) {
|
|||
"timeline");
|
||||
};
|
||||
|
||||
mod.fnDrawCallback = function fnLibDrawCallback() {
|
||||
/**
|
||||
*
|
||||
* @param {jQuery} table
|
||||
*/
|
||||
mod.drawEmptyPlaceholder = function (table) {
|
||||
var emptyRow = table.find('tr:has(td.dataTables_empty)'),
|
||||
wrapper = table.closest(".dataTables_wrapper");
|
||||
|
||||
mod.redrawChosen();
|
||||
mod.checkToolBarIcons();
|
||||
|
||||
var cb = $('th.library_checkbox'),
|
||||
emptyRow = $('#library_display').find('tr:has(td.dataTables_empty)');
|
||||
if (cb.find("input").length == 0) {
|
||||
cb.append("<input id='super-checkbox' type='checkbox'>");
|
||||
}
|
||||
|
||||
var libEmpty = $('#library_empty');
|
||||
var libEmpty = wrapper.find('.empty_placeholder');
|
||||
if (emptyRow.length > 0) {
|
||||
emptyRow.hide();
|
||||
var mediaType = parseInt($('.media_type_selector.selected').data('selection-id')),
|
||||
img = $('#library_empty_image');
|
||||
img = wrapper.find('.empty_placeholder_image');
|
||||
// Remove all classes for when we change between empty media types
|
||||
img.removeClass(function() {
|
||||
return $( this ).attr( "class" );
|
||||
return $(this).attr("class");
|
||||
});
|
||||
|
||||
var opts = AIRTIME.library.placeholder(mediaType);
|
||||
img.addClass("icon-white " + opts.icon);
|
||||
$('#library_empty_text').html(
|
||||
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>"
|
||||
|
@ -102,6 +99,19 @@ var AIRTIME = (function(AIRTIME) {
|
|||
} else {
|
||||
libEmpty.hide();
|
||||
}
|
||||
};
|
||||
|
||||
mod.fnDrawCallback = function fnLibDrawCallback() {
|
||||
var table = $('#library_display'),
|
||||
cb = table.find('th[class*="checkbox"]');
|
||||
if (cb.find("input").length == 0) {
|
||||
cb.append("<input id='super-checkbox' type='checkbox'>");
|
||||
}
|
||||
|
||||
mod.redrawChosen();
|
||||
mod.checkToolBarIcons();
|
||||
|
||||
mod.drawEmptyPlaceholder(table);
|
||||
|
||||
var sortable;
|
||||
|
||||
|
|
|
@ -89,7 +89,6 @@ var AIRTIME = (function(AIRTIME) {
|
|||
});
|
||||
|
||||
mod.DataTableTypeEnum = Object.freeze({
|
||||
//FILE: "au",
|
||||
LIBRARY : "library",
|
||||
PODCAST : "podcast",
|
||||
PODCAST_EPISODES: "podcastEpisodes"
|
||||
|
@ -661,8 +660,6 @@ var AIRTIME = (function(AIRTIME) {
|
|||
type = (type === undefined) ? AIRTIME.library.MediaTypeIntegerEnum.DEFAULT : type;
|
||||
aoData.push({name: "type", value: type});
|
||||
|
||||
//getUsabilityHint();
|
||||
|
||||
$.ajax({
|
||||
"dataType": 'json',
|
||||
"type": "POST",
|
||||
|
@ -678,7 +675,7 @@ var AIRTIME = (function(AIRTIME) {
|
|||
+ $.i18n._(" of ") + data.iTotalRecords
|
||||
+ $.i18n._(" records")
|
||||
);
|
||||
$('#library_empty').hide();
|
||||
$('.empty_placeholder').hide();
|
||||
$libTable.find('tr:has(td.dataTables_empty)').show();
|
||||
} else {
|
||||
filterMessage.text("");
|
||||
|
@ -736,7 +733,7 @@ var AIRTIME = (function(AIRTIME) {
|
|||
"oLanguage": getLibraryDatatableStrings(),
|
||||
|
||||
// z = ColResize, R = ColReorder, C = ColVis
|
||||
"sDom": 'Rf<"dt-process-rel"r><"H"<"library_toolbar"C>><"dataTables_scrolling"t<"#library_empty"<"#library_empty_image"><"#library_empty_text">>><"F"lip>>',
|
||||
"sDom": 'Rf<"dt-process-rel"r><"H"<"library_toolbar"C>><"dataTables_scrolling"t<".empty_placeholder"<".empty_placeholder_image"><".empty_placeholder_text">>><"F"lip>>',
|
||||
|
||||
"oColVis": {
|
||||
"sAlign": "right",
|
||||
|
@ -870,9 +867,9 @@ var AIRTIME = (function(AIRTIME) {
|
|||
if (r.status === 403) {
|
||||
// Hide the processing div
|
||||
$("#library_display_wrapper").find(".dt-process-rel").hide();
|
||||
$('#library_empty_text').text($.i18n._("You don't have permission to view the library."));
|
||||
$('.empty_placeholder_text').text($.i18n._("You don't have permission to view the library."));
|
||||
|
||||
$('#library_empty').show();
|
||||
$('.empty_placeholder').show();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -883,7 +880,8 @@ var AIRTIME = (function(AIRTIME) {
|
|||
table = mod.DataTableTypeEnum.LIBRARY;
|
||||
}
|
||||
|
||||
AIRTIME.library.setCurrentTable(table);
|
||||
AIRTIME.library.setCurrentTable(table, false);
|
||||
oTable = $datatables[table];
|
||||
setColumnFilter(oTable);
|
||||
oTable.fnSetFilteringDelay(350);
|
||||
|
||||
|
@ -1252,18 +1250,24 @@ var AIRTIME = (function(AIRTIME) {
|
|||
/**
|
||||
* Show the given table in the left-hand pane of the dashboard and give it internal focus
|
||||
*
|
||||
* @param table 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
|
||||
*/
|
||||
mod.setCurrentTable = function (table) {
|
||||
if (oTable && oTable === $datatables[mod.DataTableTypeEnum.PODCAST_EPISODES]) {
|
||||
oTable.fnClearTable();
|
||||
mod.setCurrentTable = function (table, redraw) {
|
||||
if (typeof redraw === 'undefined') {
|
||||
redraw = true;
|
||||
}
|
||||
var dt = $datatables[table],
|
||||
wrapper = $(dt).closest(".dataTables_wrapper");
|
||||
$("#library_content").find(".dataTables_wrapper").hide();
|
||||
wrapper.show();
|
||||
if (oTable && typeof oTable.fnClearTable === 'function') {
|
||||
oTable.fnClearTable();
|
||||
}
|
||||
// Don't redraw if we're switching to another hash for the library table
|
||||
$.when(redraw && oTable != dt ? dt.fnDraw() : function () {}).done(function () {
|
||||
$("#library_content").find(".dataTables_wrapper").hide();
|
||||
wrapper.show();
|
||||
});
|
||||
oTable = dt;
|
||||
oTable.fnDraw();
|
||||
};
|
||||
|
||||
mod.getCurrentTable = function () {
|
||||
|
@ -1371,6 +1375,9 @@ var AIRTIME = (function(AIRTIME) {
|
|||
sAjaxSource : ajaxSourceURL,
|
||||
oColReorder: {
|
||||
iFixedColumns: 1 // Checkbox
|
||||
},
|
||||
fnDrawCallback: function () {
|
||||
AIRTIME.library.drawEmptyPlaceholder($(this));
|
||||
}
|
||||
});
|
||||
|
||||
|
|
|
@ -592,6 +592,10 @@ var AIRTIME = (function (AIRTIME) {
|
|||
*/
|
||||
mod.importSelectedEpisodes = function (episodes, dt) {
|
||||
$.each(episodes, function () {
|
||||
if (this.enclosure.length > remainingDiskSpace) {
|
||||
alert("You don't have enough disk space to import " + this.title);
|
||||
return false;
|
||||
}
|
||||
if (this.file && Object.keys(this.file).length > 0) return false;
|
||||
var podcastId = this.podcast_id;
|
||||
$.post(endpoint + podcastId + '/episodes', JSON.stringify({
|
||||
|
@ -600,6 +604,8 @@ var AIRTIME = (function (AIRTIME) {
|
|||
}), function () {
|
||||
dt.reload(podcastId);
|
||||
});
|
||||
|
||||
remainingDiskSpace -= this.enclosure.length;
|
||||
});
|
||||
};
|
||||
|
||||
|
@ -631,6 +637,7 @@ var AIRTIME = (function (AIRTIME) {
|
|||
}
|
||||
params = $.extend(true, params,
|
||||
{
|
||||
bDeferRender: true,
|
||||
oColVis: {
|
||||
aiExclude: [0, 1],
|
||||
oColReorder: {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue