SAAS-1199 - stop user from dragging unimported podcast episodes

This commit is contained in:
Duncan Sommerville 2015-11-11 11:16:02 -05:00
parent c5a5839eff
commit 5264bebe57
2 changed files with 36 additions and 26 deletions

View File

@ -1004,6 +1004,13 @@ div.blockOverlay {
table.dataTable tbody tr, table.dataTable tbody tr,
table.dataTable span.DataTables_sort_icon { table.dataTable span.DataTables_sort_icon {
cursor: pointer; cursor: pointer;
-webkit-touch-callout: none;
-webkit-user-select: none;
-khtml-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
} }
table.dataTable th.ui-state-default { table.dataTable th.ui-state-default {

View File

@ -426,16 +426,17 @@ var AIRTIME = (function (AIRTIME) {
// When using static source data, we instantiate an empty table // When using static source data, we instantiate an empty table
// and pass this function the ID of the podcast we want to display. // and pass this function the ID of the podcast we want to display.
if (id) this.config.podcastId = id; if (id) this.config.podcastId = id;
var dt = this._datatable; var self = this, dt = self._datatable;
dt.block({ dt.block({
message: "", message: "",
theme: true, theme: true,
applyPlatformOpacityRules: false applyPlatformOpacityRules: false
}); });
$.get(endpoint + this.config.podcastId + '/episodes', function (json) { $.get(endpoint + self.config.podcastId + '/episodes', function (json) {
dt.fnClearTable(); dt.fnClearTable();
self.clearSelection();
dt.fnAddData(JSON.parse(json)); dt.fnAddData(JSON.parse(json));
dt.fnDraw(); // dt.fnDraw();
}).done(function () { }).done(function () {
dt.unblock(); dt.unblock();
}); });
@ -638,31 +639,33 @@ var AIRTIME = (function (AIRTIME) {
}, },
fnCreatedRow: function(nRow, aData, iDataIndex) { fnCreatedRow: function(nRow, aData, iDataIndex) {
var self = this; var self = this;
$(nRow).draggable({ if (aData.file && Object.keys(aData.file).length > 0) {
helper: function () { $(nRow).draggable({
var $row = $(this), data = self._datatable.fnGetData(nRow); helper: function () {
$row.data("aData", data.file); var $row = $(this), data = self._datatable.fnGetData(nRow);
self.selectRow(this, data, self.SELECTION_MODE.SINGLE, $row.index()); $row.data("aData", data.file);
var selected = self.getSelectedRows().length, container, self.selectRow(this, data, self.SELECTION_MODE.SINGLE, $row.index());
width = self._$wrapperDOMNode.closest(".dataTables_wrapper").outerWidth(), message; var selected = self.getSelectedRows().length, container,
width = self._$wrapperDOMNode.closest(".dataTables_wrapper").outerWidth(), message;
message = sprintf($.i18n._(selected > 1 ? "Adding %s Items" : "Adding %s Item"), selected); message = sprintf($.i18n._(selected > 1 ? "Adding %s Items" : "Adding %s Item"), selected);
container = $('<div/>').attr('id', 'draggingContainer').append('<tr/>') container = $('<div/>').attr('id', 'draggingContainer').append('<tr/>')
.find("tr").append('<td/>').find("td") .find("tr").append('<td/>').find("td")
.attr("colspan", 100).width(width).css("max-width", "none") .attr("colspan", 100).width(width).css("max-width", "none")
.addClass("ui-state-highlight").append(message).end().end(); .addClass("ui-state-highlight").append(message).end().end();
return container; return container;
}, },
tolerance: 'pointer', tolerance: 'pointer',
cursor: 'move', cursor: 'move',
cursorAt: { cursorAt: {
top: 20, top: 20,
left: Math.floor(self._datatable.outerWidth() / 2) left: Math.floor(self._datatable.outerWidth() / 2)
}, },
distance: 25, // min-distance for dragging distance: 25, // min-distance for dragging
connectToSortable: $("#show_builder_table, .active-tab .spl_sortable") connectToSortable: $("#show_builder_table, .active-tab .spl_sortable")
}); });
}
} }
} }
); );