From a3f1cf1d5623ef9e15ae2615aeadf6bc702a3790 Mon Sep 17 00:00:00 2001 From: Duncan Sommerville Date: Mon, 22 Jun 2015 10:46:29 -0400 Subject: [PATCH 1/2] CC-6060 - Fix breaking tooltips when viewing context menu in library --- .../public/js/airtime/library/library.js | 22 ++++++++++--------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/airtime_mvc/public/js/airtime/library/library.js b/airtime_mvc/public/js/airtime/library/library.js index fbe7cb5d5..4edf022ad 100644 --- a/airtime_mvc/public/js/airtime/library/library.js +++ b/airtime_mvc/public/js/airtime/library/library.js @@ -720,17 +720,19 @@ var AIRTIME = (function(AIRTIME) { // icon. $(nRow).find("td:not(.library_checkbox, .library_type)").qtip({ content: { - text: $.i18n._("Loading..."), + text: function(event, api) { + $.get(baseUrl+"library/get-file-metadata", + ({format: "html", id : aData.id, type: aData.ftype}), + function (html) { + api.set('content.text', html); + }, "html") + .fail(function (xhr, status, error) { + api.set('content.text', status + ': ' + error) + }); + return 'Loading...'; + }, title: { text: aData.track_title - }, - ajax: { - url: baseUrl+"Library/get-file-metadata", - type: "get", - data: ({format: "html", id : aData.id, type: aData.ftype}), - success: function(data, status) { - this.set('content.text', data); - } } }, position: { @@ -753,7 +755,7 @@ var AIRTIME = (function(AIRTIME) { show: function(event, api) { // Only show the tooltip if it was a right-click if(event.originalEvent.button !== 2) { - event.preventDefault(); + event.preventDefault(); } } }, From c59f401eb1bc5fb09057ea4259455d92f0794d29 Mon Sep 17 00:00:00 2001 From: Duncan Sommerville Date: Thu, 25 Jun 2015 18:21:22 -0400 Subject: [PATCH 2/2] Fix shift selection in library and builder views --- .../public/js/airtime/library/library.js | 37 ++++++++++++------- 1 file changed, 23 insertions(+), 14 deletions(-) diff --git a/airtime_mvc/public/js/airtime/library/library.js b/airtime_mvc/public/js/airtime/library/library.js index 4edf022ad..ebfd0aa0b 100644 --- a/airtime_mvc/public/js/airtime/library/library.js +++ b/airtime_mvc/public/js/airtime/library/library.js @@ -6,7 +6,9 @@ var AIRTIME = (function(AIRTIME) { $libTable, LIB_SELECTED_CLASS = "lib-selected", chosenItems = {}, - visibleChosenItems = {}; + visibleChosenItems = {}, + $previouslySelected; + // we need to know whether the criteria value is string or // numeric in order to provide a single textbox or range textboxes @@ -868,28 +870,35 @@ var AIRTIME = (function(AIRTIME) { }); $libTable.find("tbody").on("click", "input[type=checkbox]", function(ev) { - + var $cb = $(this), - $prev, $tr = $cb.parents("tr"), - $trs; - + // Get the ID of the selected row + $rowId = $tr.attr("id"); + if ($cb.is(":checked")) { - - if (ev.shiftKey) { - $prev = $libTable.find("tbody").find("tr."+LIB_SELECTED_CLASS).eq(-1); - $trs = $prev.nextUntil($tr); - - $trs.each(function(i, el){ - mod.selectItem($(el)); - }); + if (ev.shiftKey && $previouslySelected !== undefined) { + // If the selected row comes before the previously selected row, + // we want to select previous rows, otherwise we select next + if ($previouslySelected.prevAll("#"+$rowId).length !== 0) { + $previouslySelected.prevUntil($tr).each(function(i, el){ + mod.selectItem($(el)); + }); + } else { + $previouslySelected.nextUntil($tr).each(function(i, el){ + mod.selectItem($(el)); + }); + } } mod.selectItem($tr); + // Remember this row so we can properly multiselect + $previouslySelected = $tr; } else { - mod.deselectItem($tr); + mod.deselectItem($tr); } + }); checkImportStatus();