Merge branch 'saas-showbuilder' into saas-showbuilder-contextmenus

This commit is contained in:
Albert Santoni 2015-08-18 13:11:17 -04:00
commit b645f1c2ed
7 changed files with 68 additions and 24 deletions

View file

@ -842,8 +842,8 @@ var AIRTIME = (function(AIRTIME) {
AIRTIME.library.dblClickAdd(data, data.ftype);
});
$libTable.find("tbody").on("mousedown", "tr", function(ev) {
var $tr = $(this),
$libTable.find("tbody").on("mousedown", "tr > td.library_checkbox", function(ev) {
var $tr = $(this).parent(),
// Get the ID of the selected row
$rowId = $tr.attr("id");
@ -877,19 +877,53 @@ var AIRTIME = (function(AIRTIME) {
$previouslySelected = $tr;
});
$libTable.find("tbody").on("click", "tr", function(ev) {
//ev.preventDefault();
$libTable.find("tbody").on("mousedown", "tr > td:not(.library_checkbox)", function(ev) {
var $tr = $(this).parent(),
// Get the ID of the selected row
$rowId = $tr.attr("id");
if (ev.shiftKey && $previouslySelected !== undefined) {
if ($previouslySelected.attr("id") == $rowId) {
return;
}
// 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));
mod.checkItem($(el));
});
} else {
$previouslySelected.nextUntil($tr).each(function (i, el) {
mod.selectItem($(el));
mod.checkItem($(el));
});
}
} else if (!ev.ctrlKey) {
AIRTIME.library.selectNone();
}
mod.selectItem($tr);
mod.checkItem($tr);
// Remember this row so we can properly multiselect
$previouslySelected = $tr;
});
$libTable.find("tbody").on("click", "tr", function() {
var tr = $(this);
if (flagForDeselection) {
flagForDeselection = false;
mod.deselectItem($(this));
mod.uncheckItem($(this));
mod.deselectItem(tr);
mod.uncheckItem(tr);
} else {
mod.checkItem($(this));
mod.checkItem(tr);
}
});
$libTable.find("thead").on("click", "th > input[type='checkbox']", function(ev) {
$libTable.find("thead").on("click", "th > input[type='checkbox']", function() {
if ($(this).is(":checked")) {
AIRTIME.library.selectCurrentPage();
$(this).prop("checked", true);

View file

@ -436,6 +436,8 @@ var AIRTIME = (function(AIRTIME){
* Should all be moved to builder.js eventually
*/
function buildNewTab(json) {
AIRTIME.library.selectNone();
var tabId = $openTabs[json.type + json.id];
if (tabId !== undefined) {
AIRTIME.showbuilder.switchTab($("#pl-tab-content-" + tabId), $("#pl-tab-" + tabId));
@ -443,7 +445,7 @@ var AIRTIME = (function(AIRTIME){
}
$tabCount++;
var wrapper = "<div tab-id='" + $tabCount + "' id='pl-tab-content-" + $tabCount + "' class='side_playlist pl-content'><div class='editor_pane_wrapper'></div></div>",
var wrapper = "<div tab-type='" + json.type + "' tab-id='" + $tabCount + "' id='pl-tab-content-" + $tabCount + "' class='side_playlist pl-content'><div class='editor_pane_wrapper'></div></div>",
t = $("#show_builder").append(wrapper).find("#pl-tab-content-" + $tabCount),
pane = $(".editor_pane_wrapper:last"),
name = json.type == "md" ? // file
@ -1250,6 +1252,7 @@ var AIRTIME = (function(AIRTIME){
}
mod.fnAddItems = function(aItems, iAfter, sAddType) {
AIRTIME.library.selectNone();
var sUrl = baseUrl+"new-playlist/add-items";
oData = {"aItems": aItems, "afterItem": iAfter, "type": sAddType};
playlistRequest(sUrl, oData);