CC-3742 : Library: could be confused by carrying over selected state betwee pages

This commit is contained in:
Naomi Aro 2012-05-02 14:40:27 +02:00
parent c5f9288aab
commit 08d939d736
3 changed files with 31 additions and 18 deletions

View File

@ -40,22 +40,21 @@ var AIRTIME = (function(AIRTIME){
$('#library_display tr[id ^= "au"]').draggable({
helper: function(){
var selected = $('#library_display tr:not(:first) input:checked').parents('tr[id^="au"]'),
mod.selectItem($(this));
var selected = mod.getChosenAudioFilesLength(),
container,
message,
li = $("#side_playlist ul li:first"),
width = li.width(),
height = li.height();
if (selected.length === 0) {
selected = $(this);
}
if (selected.length === 1) {
message = "Adding "+selected.length+" Item.";
if (selected === 1) {
message = "Adding "+selected+" Item.";
}
else {
message = "Adding "+selected.length+" Items.";
message = "Adding "+selected+" Items.";
}
container = $('<div class="helper"/>')

View File

@ -40,23 +40,21 @@ var AIRTIME = (function(AIRTIME){
$('#library_display tr:not(:first)').draggable({
helper: function(){
var selected = $('#library_display tr:not(:first) input:checked').parents('tr'),
mod.selectItem($(this));
var selected = mod.getChosenItemsLength(),
container,
thead = $("#show_builder_table thead"),
colspan = thead.find("th").length,
width = thead.find("tr:first").width(),
message;
//if nothing is checked select the dragged item.
if (selected.length === 0) {
selected = $(this);
}
if (selected.length === 1) {
message = "Adding "+selected.length+" Item.";
if (selected === 1) {
message = "Adding "+selected+" Item.";
}
else {
message = "Adding "+selected.length+" Items.";
message = "Adding "+selected+" Items.";
}
container = $('<div/>').attr('id', 'draggingContainer')

View File

@ -18,6 +18,22 @@ var AIRTIME = (function(AIRTIME) {
return selected;
};
mod.getChosenAudioFilesLength = function(){
var files = Object.keys(chosenItems),
i, length,
count = 0,
reAudio=/^au/ ;
for (i = 0, length = files.length; i < length; i++) {
if (files[i].search(reAudio) !== -1) {
count++;
}
}
return count;
};
mod.createToolbarDropDown = function() {
$.contextMenu({