From 28759a2d34420f6eef5aae93b3fdd3667578fe96 Mon Sep 17 00:00:00 2001 From: Naomi Aro Date: Mon, 27 Feb 2012 16:01:05 +0100 Subject: [PATCH] CC-3354 : timeline drag and drop changing helper to say just the number of items being moved like gtalk. --- .../library/events/library_showbuilder.js | 26 ++++++++++++++++--- .../public/js/airtime/showbuilder/builder.js | 19 ++++++++++---- 2 files changed, 36 insertions(+), 9 deletions(-) diff --git a/airtime_mvc/public/js/airtime/library/events/library_showbuilder.js b/airtime_mvc/public/js/airtime/library/events/library_showbuilder.js index 311ecf9b5..f51e62c1d 100644 --- a/airtime_mvc/public/js/airtime/library/events/library_showbuilder.js +++ b/airtime_mvc/public/js/airtime/library/events/library_showbuilder.js @@ -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 = $('
').attr('id', 'draggingContainer'); - container.append(selected.clone()); + + container = $('
').attr('id', 'draggingContainer') + .append('') + .find("tr") + .append('') + .find("td") + .attr("colspan", colspan) + .width(width) + .addClass("ui-state-highlight") + .append("Moving "+selected.length+" Items.") + .end() + .end(); + return container; }, cursor: 'pointer', diff --git a/airtime_mvc/public/js/airtime/showbuilder/builder.js b/airtime_mvc/public/js/airtime/showbuilder/builder.js index b003f7ae6..7e55e262b 100644 --- a/airtime_mvc/public/js/airtime/showbuilder/builder.js +++ b/airtime_mvc/public/js/airtime/showbuilder/builder.js @@ -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(); }