SAAS-1165 - implement simple one-item drag and drop for podcast episodes table; still needs work

This commit is contained in:
Duncan Sommerville 2015-11-06 17:47:46 -05:00
parent 729360e1a1
commit a7881b8941
6 changed files with 48 additions and 51 deletions

View file

@ -109,46 +109,6 @@ var AIRTIME = (function(AIRTIME) {
sortable = "#show_builder_table";
} else {
sortable = ".active-tab .spl_sortable";
//$('#library_display tr[class*="lib-"]')
// .draggable(
// {
// helper: function () {
//
// var $el = $(this), selected = mod
// .getChosenAudioFilesLength(), container, message,
// width = $(this).width(), height = 55;
//
// // dragging an element that has an unselected
// // checkbox.
// if (mod.isChosenItem($el) === false) {
// selected++;
// }
//
// if (selected === 1) {
// message = $.i18n._("Adding 1 Item");
// } else {
// message = sprintf($.i18n._("Adding %s Items"), selected);
// }
//
// container = $('<div class="helper"/>').append(
// "<li/>").find("li").addClass(
// "ui-state-default").append("<div/>")
// .find("div").addClass(
// "list-item-container").append(
// message).end().width(width)
// .height(height).end();
//
// return container;
// },
// create: function(event, ui) {
// $(this).draggable("option", "cursorAt", {
// left: Math.floor(this.clientWidth / 2)
// });
// },
// cursor: 'move',
// distance: 25, // min-distance for dragging
// connectToSortable: '.active-tab .spl_sortable'
// });
}
$('#library_display tr[class*="lib-"]')

View file

@ -1264,6 +1264,10 @@ var AIRTIME = (function(AIRTIME) {
oTable.fnDraw();
};
mod.getCurrentTable = function () {
return oTable;
};
mod.openPodcastEpisodeDialog = function () {
var episode = mod.podcastEpisodeTableWidget.getSelectedRows()[0];
$("body").append("<div id='podcast_episode_dialog'></div>");

View file

@ -420,6 +420,7 @@ var AIRTIME = (function (AIRTIME) {
dt.fnClearTable();
dt.fnAddData(JSON.parse(json));
dt.fnDraw();
}).done(function () {
dt.unblock();
});
};
@ -597,13 +598,38 @@ var AIRTIME = (function (AIRTIME) {
params = $.extend(true, params,
{
oColVis: {
sAlign: 'right',
aiExclude: [0, 1],
buttonText: $.i18n._("Columns"),
iOverlayFade: 0,
oColReorder: {
iFixedColumns: 1 // Checkbox
}
},
fnCreatedRow: function(nRow, aData, iDataIndex) {
var self = this;
$(nRow).draggable({
helper: function () {
var $row = $(this);
$row.data("aData", self._datatable.fnGetData($(nRow).index()).file);
self.selectRow(this, self._datatable.fnGetData($row.index()), self.SELECTION_MODE.SINGLE, $row.index());
var selected = self.getSelectedRows().length, container,
width = self._$wrapperDOMNode.closest(".dataTables_wrapper").outerWidth(), message;
message = sprintf($.i18n._("Adding %s Item%s"), selected, selected > 1 ? "s" : "");
container = $('<div/>').attr('id', 'draggingContainer').append('<tr/>')
.find("tr").append('<td/>').find("td")
.attr("colspan", 100).width(width).css("max-width", "none")
.addClass("ui-state-highlight").append(message).end().end();
return container;
},
tolerance: 'pointer',
cursor: 'move',
cursorAt: {
top: 20,
left: Math.floor(self._datatable.outerWidth() / 2)
},
distance: 25, // min-distance for dragging
connectToSortable: $("#show_builder_table, .active-tab .spl_sortable")
});
}
}
);