SAAS-948 - fix smartblock save and tab close functionality, implement 'super' checkbox
This commit is contained in:
parent
849b8038ce
commit
c9f9bed2d6
6 changed files with 61 additions and 24 deletions
|
@ -287,10 +287,14 @@ var AIRTIME = (function(AIRTIME) {
|
|||
|
||||
mod.checkItem = function($el) {
|
||||
$el.find(".library_checkbox > input").prop('checked', true);
|
||||
$("#super-checkbox").prop("checked", true);
|
||||
};
|
||||
|
||||
mod.uncheckItem = function($el) {
|
||||
$el.find(".library_checkbox > input").prop('checked', false);
|
||||
if ($("." + LIB_SELECTED_CLASS.length == 0)) {
|
||||
$("#super-checkbox").prop("checked", false);
|
||||
}
|
||||
};
|
||||
|
||||
mod.highlightItem = function($el) {
|
||||
|
@ -362,20 +366,23 @@ var AIRTIME = (function(AIRTIME) {
|
|||
mod.checkToolBarIcons();
|
||||
};
|
||||
|
||||
mod.fnRedraw = function() {
|
||||
oTable.fnStandingRedraw();
|
||||
};
|
||||
|
||||
mod.fnDeleteItems = function(aMedia) {
|
||||
//Prevent the user from spamming the delete button while the AJAX request is in progress
|
||||
AIRTIME.button.disableButton("btn-group #sb-trash", false);
|
||||
var openTabObjectIds = $(".obj_id"),
|
||||
mediaIds = [];
|
||||
for (var i in aMedia) {
|
||||
mediaIds.push(aMedia[i].id.toString());
|
||||
mediaIds.push(parseInt(aMedia[i].id));
|
||||
}
|
||||
|
||||
openTabObjectIds.each(function(i, el) {
|
||||
var v = $(el).val();
|
||||
var v = parseInt($(el).val());
|
||||
if ($.inArray(v, mediaIds) > -1) {
|
||||
AIRTIME.playlist.fnOpenPlaylist({id: v});
|
||||
AIRTIME.playlist.closeTab();
|
||||
AIRTIME.playlist.closeTab($(el).closest(".pl-content").attr("tab-id"));
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -841,9 +848,19 @@ var AIRTIME = (function(AIRTIME) {
|
|||
}
|
||||
});
|
||||
|
||||
$libTable.find("thead").on("click", "th > input[type='checkbox']", function(ev) {
|
||||
if ($(this).is(":checked")) {
|
||||
AIRTIME.library.selectCurrentPage();
|
||||
$(this).prop("checked", true);
|
||||
} else {
|
||||
AIRTIME.library.selectNone();
|
||||
$(this).prop("checked", false);
|
||||
}
|
||||
});
|
||||
|
||||
// begin context menu initialization.
|
||||
$.contextMenu({
|
||||
selector: '#library_display tr',
|
||||
selector: '#library_display tr:has(td)',
|
||||
trigger: "right",
|
||||
|
||||
build: function($el, e) {
|
||||
|
|
|
@ -443,7 +443,7 @@ var AIRTIME = (function(AIRTIME){
|
|||
}
|
||||
$tabCount++;
|
||||
|
||||
var wrapper = "<div id='pl-tab-content-" + $tabCount + "' class='side_playlist pl-content'><div class='editor_pane_wrapper'></div></div>",
|
||||
var wrapper = "<div 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
|
||||
|
@ -514,20 +514,21 @@ var AIRTIME = (function(AIRTIME){
|
|||
$("#pl_edit").hide();
|
||||
}
|
||||
|
||||
function closeTab() {
|
||||
var pane = $(".active-tab"),
|
||||
tab = $(".nav.nav-tabs .active"),
|
||||
function closeTab(id) {
|
||||
var pane = id ? $(".pl-content[tab-id='" + id + "']") : $(".active-tab"),
|
||||
tab = id ? $(".nav.nav-tabs [tab-id='" + id + "']") : $(".nav.nav-tabs .active"),
|
||||
toPane = pane.next().length > 0 ? pane.next() : pane.prev(),
|
||||
toTab = tab.next().length > 0 ? tab.next() : tab.prev(),
|
||||
objId = pane.find(".obj_id").val();
|
||||
objId = id ? id : pane.find(".obj_id").val();
|
||||
delete $openTabs[tab.attr("tab-type") + objId];
|
||||
|
||||
tab.remove();
|
||||
$pl.remove();
|
||||
AIRTIME.showbuilder.switchTab(toPane, toTab);
|
||||
}
|
||||
|
||||
mod.closeTab = function() {
|
||||
closeTab();
|
||||
mod.closeTab = function(id) {
|
||||
closeTab(id);
|
||||
};
|
||||
|
||||
//Purpose of this function is to iterate over all playlist elements
|
||||
|
@ -967,6 +968,7 @@ var AIRTIME = (function(AIRTIME){
|
|||
alert(json.error);
|
||||
}
|
||||
if (json.html !== undefined) {
|
||||
console.log(json);
|
||||
closeTab();
|
||||
openPlaylist(json);
|
||||
}
|
||||
|
@ -1063,7 +1065,6 @@ var AIRTIME = (function(AIRTIME){
|
|||
//http://stackoverflow.com/questions/2150002/jquery-ui-sortable-how-can-i-change-the-appearance-of-the-placeholder-object
|
||||
placeholder: {
|
||||
element: function(currentItem) {
|
||||
|
||||
return $('<li class="placeholder ui-state-highlight"></li>')[0];
|
||||
},
|
||||
update: function(container, p) {
|
||||
|
@ -1071,10 +1072,12 @@ var AIRTIME = (function(AIRTIME){
|
|||
}
|
||||
},
|
||||
forcePlaceholderSize: true,
|
||||
handle: 'div.list-item-container',
|
||||
//handle: 'div.list-item-container',
|
||||
start: function(event, ui) {
|
||||
ui.placeholder.height(56);
|
||||
},
|
||||
axis: "y",
|
||||
containment: "document",
|
||||
receive: fnReceive,
|
||||
update: fnUpdate
|
||||
};
|
||||
|
|
|
@ -70,6 +70,11 @@ var AIRTIME = (function(AIRTIME) {
|
|||
mod.redrawChosen();
|
||||
mod.checkToolBarIcons();
|
||||
|
||||
var cb = $('th.library_checkbox');
|
||||
if (cb.find("input").length == 0) {
|
||||
cb.append("<input id='super-checkbox' type='checkbox'>");
|
||||
}
|
||||
|
||||
if ($("#show_builder_table").is(":visible")) {
|
||||
$('#library_display tr.lib-audio, tr.lib-pl, tr.lib-stream')
|
||||
.draggable(
|
||||
|
@ -116,9 +121,8 @@ var AIRTIME = (function(AIRTIME) {
|
|||
helper: function () {
|
||||
|
||||
var $el = $(this), selected = mod
|
||||
.getChosenAudioFilesLength(), container, message, li = $(".side_playlist.active-tab ul.spl_sortable li:first"),
|
||||
width = li.width(), height = 55;
|
||||
if (width > 798) width = 798;
|
||||
.getChosenAudioFilesLength(), container, message,
|
||||
width = $(this).width(), height = 55;
|
||||
|
||||
// dragging an element that has an unselected
|
||||
// checkbox.
|
||||
|
|
|
@ -119,6 +119,7 @@ var AIRTIME = (function(AIRTIME){
|
|||
AIRTIME.playlist.setAsActive();
|
||||
}
|
||||
AIRTIME.playlist.onResize();
|
||||
AIRTIME.library.fnRedraw();
|
||||
};
|
||||
|
||||
|
||||
|
@ -822,6 +823,7 @@ var AIRTIME = (function(AIRTIME){
|
|||
$(this).find(".sb-checkbox > input").prop('checked', true);
|
||||
}
|
||||
selectedRows = $("." + SB_SELECTED_CLASS);
|
||||
mod.checkToolBarIcons();
|
||||
});
|
||||
|
||||
//begin context menu initialization.
|
||||
|
@ -1017,7 +1019,7 @@ var AIRTIME = (function(AIRTIME){
|
|||
return {
|
||||
placeholder: "sb-placeholder ui-state-highlight",
|
||||
//forcePlaceholderSize: true,
|
||||
distance: 10,
|
||||
distance: 25,
|
||||
helper:
|
||||
function(event, item) {
|
||||
var selected = mod.getSelectedData(NOW_PLAYING_CLASS),
|
||||
|
@ -1069,6 +1071,8 @@ var AIRTIME = (function(AIRTIME){
|
|||
cancel: '.sb-footer',
|
||||
receive: fnReceive,
|
||||
update: fnUpdate,
|
||||
axis: "y",
|
||||
containment: "document",
|
||||
start: function(event, ui) {
|
||||
var elements = $sbTable.find('tr.'+SB_SELECTED_CLASS).not("."+NOW_PLAYING_CLASS);
|
||||
elements.hide();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue