CC-3354 : timeline drag and drop

changing helper to say just the number of items being moved like gtalk.
This commit is contained in:
Naomi Aro 2012-02-27 16:01:05 +01:00
parent f01a872bea
commit 28759a2d34
2 changed files with 36 additions and 9 deletions

View File

@ -20,12 +20,30 @@ var AIRTIME = (function(AIRTIME){
$('#library_display tr:not(:first)').draggable({
helper: function(){
var selected = $('#library_display tr:not(:first) input:checked').parents('tr');
var selected = $('#library_display tr:not(:first) input:checked').parents('tr'),
aItems = [],
container,
thead = $("#show_builder_table thead"),
colspan = thead.find("th").length,
width = thead.find("tr:first").width();
//if nothing is checked select the dragged item.
if (selected.length === 0) {
selected = $(this);
selected = $(this);
}
var container = $('<div/>').attr('id', 'draggingContainer');
container.append(selected.clone());
container = $('<div/>').attr('id', 'draggingContainer')
.append('<tr/>')
.find("tr")
.append('<td/>')
.find("td")
.attr("colspan", colspan)
.width(width)
.addClass("ui-state-highlight")
.append("Moving "+selected.length+" Items.")
.end()
.end();
return container;
},
cursor: 'pointer',

View File

@ -514,7 +514,19 @@ $(document).ready(function() {
};
fnReceive = function(event, ui) {
origTrs = ui.helper.find("tr");
var selected = $('#library_display tr:not(:first) input:checked').parents('tr'),
aItems = [];
//if nothing is checked select the dragged item.
if (selected.length === 0) {
selected = ui.item;
}
selected.each(function(i, el) {
aItems.push($(el).data("aData"));
});
origTrs = aItems;
html = ui.helper.html();
};
@ -529,10 +541,7 @@ $(document).ready(function() {
.empty()
.after(html);
origTrs.each(function(i, el){
aItemData.push($("#"+$(el).attr("id")).data("aData"));
});
aItemData = origTrs;
origTrs = undefined;
fnAdd();
}