CC-3799 : Dragging and dropping a track from the library causes the track in the library to be selected
This commit is contained in:
parent
9bb8e2ad8e
commit
e61924de37
5 changed files with 38 additions and 29 deletions
|
@ -48,7 +48,7 @@ var AIRTIME = (function(AIRTIME){
|
||||||
$('#library_display tr.lib-audio').draggable({
|
$('#library_display tr.lib-audio').draggable({
|
||||||
helper: function(){
|
helper: function(){
|
||||||
|
|
||||||
mod.selectItem($(this));
|
mod.addToChosen($(this));
|
||||||
|
|
||||||
var selected = mod.getChosenAudioFilesLength(),
|
var selected = mod.getChosenAudioFilesLength(),
|
||||||
container,
|
container,
|
||||||
|
|
|
@ -48,7 +48,7 @@ var AIRTIME = (function(AIRTIME){
|
||||||
$('#library_display tr.lib-audio, tr.lib-pl').draggable({
|
$('#library_display tr.lib-audio, tr.lib-pl').draggable({
|
||||||
helper: function(){
|
helper: function(){
|
||||||
|
|
||||||
mod.selectItem($(this));
|
mod.addToChosen($(this));
|
||||||
|
|
||||||
var selected = mod.getChosenItemsLength(),
|
var selected = mod.getChosenItemsLength(),
|
||||||
container,
|
container,
|
||||||
|
|
|
@ -98,6 +98,21 @@ var AIRTIME = (function(AIRTIME) {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
mod.addToChosen = function($el) {
|
||||||
|
var id = $el.attr("id");
|
||||||
|
|
||||||
|
chosenItems[id] = $el.data('aData');
|
||||||
|
};
|
||||||
|
|
||||||
|
mod.removeFromChosen = function($el) {
|
||||||
|
var id = $el.attr("id");
|
||||||
|
|
||||||
|
//used to not keep dragged items selected.
|
||||||
|
if (!$el.hasClass(LIB_SELECTED_CLASS)) {
|
||||||
|
delete chosenItems[id];
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
mod.highlightItem = function($el) {
|
mod.highlightItem = function($el) {
|
||||||
var $input = $el.find("input");
|
var $input = $el.find("input");
|
||||||
|
|
||||||
|
@ -105,26 +120,25 @@ var AIRTIME = (function(AIRTIME) {
|
||||||
$el.addClass(LIB_SELECTED_CLASS);
|
$el.addClass(LIB_SELECTED_CLASS);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
mod.unHighlightItem = function($el) {
|
||||||
|
var $input = $el.find("input");
|
||||||
|
|
||||||
|
$input.attr("checked", false);
|
||||||
|
$el.removeClass(LIB_SELECTED_CLASS);
|
||||||
|
};
|
||||||
|
|
||||||
mod.selectItem = function($el) {
|
mod.selectItem = function($el) {
|
||||||
var id;
|
|
||||||
|
|
||||||
mod.highlightItem($el);
|
mod.highlightItem($el);
|
||||||
|
mod.addToChosen($el);
|
||||||
id = $el.attr("id");
|
|
||||||
chosenItems[id] = $el.data('aData');
|
|
||||||
|
|
||||||
mod.checkToolBarIcons();
|
mod.checkToolBarIcons();
|
||||||
};
|
};
|
||||||
|
|
||||||
mod.deselectItem = function($el) {
|
mod.deselectItem = function($el) {
|
||||||
var id,
|
|
||||||
$input = $el.find("input");
|
|
||||||
|
|
||||||
$input.attr("checked", false);
|
mod.unHighlightItem($el);
|
||||||
$el.removeClass(LIB_SELECTED_CLASS);
|
mod.removeFromChosen($el);
|
||||||
|
|
||||||
id = $el.attr("id");
|
|
||||||
delete chosenItems[id];
|
|
||||||
|
|
||||||
mod.checkToolBarIcons();
|
mod.checkToolBarIcons();
|
||||||
};
|
};
|
||||||
|
|
|
@ -278,7 +278,8 @@ var AIRTIME = (function(AIRTIME){
|
||||||
function redrawLib() {
|
function redrawLib() {
|
||||||
var dt = $lib.find("#library_display").dataTable();
|
var dt = $lib.find("#library_display").dataTable();
|
||||||
|
|
||||||
dt.fnDraw();
|
dt.fnStandingRedraw();
|
||||||
|
AIRTIME.library.redrawChosen();
|
||||||
}
|
}
|
||||||
|
|
||||||
function setPlaylistContent(json) {
|
function setPlaylistContent(json) {
|
||||||
|
@ -523,10 +524,6 @@ var AIRTIME = (function(AIRTIME){
|
||||||
|
|
||||||
//filter out anything that isn't an audiofile.
|
//filter out anything that isn't an audiofile.
|
||||||
aSelected = AIRTIME.library.getSelectedData();
|
aSelected = AIRTIME.library.getSelectedData();
|
||||||
//if nothing is checked select the dragged item.
|
|
||||||
if (aSelected.length === 0) {
|
|
||||||
aSelected.push(ui.item.data("aData"));
|
|
||||||
}
|
|
||||||
|
|
||||||
for (i = 0, length = aSelected.length; i < length; i++) {
|
for (i = 0, length = aSelected.length; i < length; i++) {
|
||||||
if (aSelected[i].ftype === "audioclip") {
|
if (aSelected[i].ftype === "audioclip") {
|
||||||
|
@ -536,6 +533,8 @@ var AIRTIME = (function(AIRTIME){
|
||||||
|
|
||||||
aReceiveItems = aItems;
|
aReceiveItems = aItems;
|
||||||
html = ui.helper.html();
|
html = ui.helper.html();
|
||||||
|
|
||||||
|
AIRTIME.library.removeFromChosen(ui.item);
|
||||||
};
|
};
|
||||||
|
|
||||||
fnUpdate = function(event, ui) {
|
fnUpdate = function(event, ui) {
|
||||||
|
|
|
@ -699,14 +699,10 @@ var AIRTIME = (function(AIRTIME){
|
||||||
var aItems = [];
|
var aItems = [];
|
||||||
|
|
||||||
aItems = AIRTIME.library.getSelectedData();
|
aItems = AIRTIME.library.getSelectedData();
|
||||||
|
|
||||||
//if nothing is checked select the dragged item.
|
|
||||||
if (aItems.length === 0) {
|
|
||||||
aItems.push(ui.item.data("aData"));
|
|
||||||
}
|
|
||||||
|
|
||||||
origTrs = aItems;
|
origTrs = aItems;
|
||||||
html = ui.helper.html();
|
html = ui.helper.html();
|
||||||
|
|
||||||
|
AIRTIME.library.removeFromChosen(ui.item);
|
||||||
};
|
};
|
||||||
|
|
||||||
fnUpdate = function(event, ui) {
|
fnUpdate = function(event, ui) {
|
||||||
|
@ -764,10 +760,10 @@ var AIRTIME = (function(AIRTIME){
|
||||||
height = trfirst.height(),
|
height = trfirst.height(),
|
||||||
message;
|
message;
|
||||||
|
|
||||||
//if nothing is checked select the dragged item.
|
//if nothing is checked select the dragged item.
|
||||||
if (selected.length === 0) {
|
if (selected.length === 0) {
|
||||||
selected = [item.data("aData")];
|
selected = [item.data("aData")];
|
||||||
}
|
}
|
||||||
|
|
||||||
if (selected.length === 1) {
|
if (selected.length === 1) {
|
||||||
message = "Moving "+selected.length+" Item.";
|
message = "Moving "+selected.length+" Item.";
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue