SAAS-1200 - remove context menu from schedule tracks dialog (calendar)

This commit is contained in:
Duncan Sommerville 2015-11-11 17:07:24 -05:00
parent 5b325acb34
commit 86b7dec6fb
1 changed files with 58 additions and 46 deletions

View File

@ -9,7 +9,8 @@ var AIRTIME = (function(AIRTIME) {
visibleChosenItems = {},
$previouslySelected,
flagForDeselection = false,
$datatables = {};
$datatables = {},
onDashboard = (window.location.href.indexOf("showbuilder") > -1);
// we need to know whether the criteria value is string or
@ -525,18 +526,12 @@ var AIRTIME = (function(AIRTIME) {
$libTable = $("#library_display");
/* ############################################
DATATABLES
############################################ */
mod.libraryDataTable = $libTable.dataTable({
// put hidden columns at the top to insure they can never be visible
// on the table through column reordering.
//IMPORTANT: WHEN ADDING A NEW COLUMN PLEASE CONSULT WITH THE WIKI
// https://wiki.sourcefabric.org/display/CC/Adding+a+new+library+datatable+column
"aoColumns": [
var cols = [
/* ftype */ { "sTitle" : "" , "mDataProp" : "ftype" , "bSearchable" : false , "bVisible" : false },
/* Checkbox */ { "sTitle" : "" , "mDataProp" : "checkbox" , "bSortable" : false , "bSearchable" : false , "sWidth" : "16px" , "sClass" : "library_checkbox" },
/* Type */ { "sTitle" : "" , "mDataProp" : "image" , "bSortable" : false , "bSearchable" : false , "sWidth" : "16px" , "sClass" : "library_type" , "iDataSort" : 0 },
@ -569,15 +564,30 @@ var AIRTIME = (function(AIRTIME) {
/* Track Number */ { "sTitle" : $.i18n._("Track Number") , "mDataProp" : "track_number" , "bVisible" : false , "sClass" : "library_track" , "sWidth" : "125px" },
/* Upload Time */ { "sTitle" : $.i18n._("Uploaded") , "mDataProp" : "utime" , "bVisible" : false , "sClass" : "library_upload_time" , "sWidth" : "155px" },
/* Website */ { "sTitle" : $.i18n._("Website") , "mDataProp" : "info_url" , "bVisible" : false , "sClass" : "library_url" , "sWidth" : "150px" },
/* Year */ { "sTitle" : $.i18n._("Year") , "mDataProp" : "year" , "bVisible" : false , "sClass" : "library_year" , "sWidth" : "60px" },
/* Context Menu */ { "sTitle" : "" , "mDataProp" : "options" , "bSortable" : false , "bSearchable" : false , "sWidth" : "20px", "sClass" : "library_actions" }
],
/* Year */ { "sTitle" : $.i18n._("Year") , "mDataProp" : "year" , "bVisible" : false , "sClass" : "library_year" , "sWidth" : "60px" }
];
if (onDashboard) {
cols.push(
/* Context Menu */ { "sTitle" : "" , "mDataProp" : "options" , "bSortable" : false , "bSearchable" : false , "sWidth" : "20px", "sClass" : "library_actions" }
);
}
/* ############################################
DATATABLES
############################################ */
mod.libraryDataTable = $libTable.dataTable({
// put hidden columns at the top to insure they can never be visible
// on the table through column reordering.
//IMPORTANT: WHEN ADDING A NEW COLUMN PLEASE CONSULT WITH THE WIKI
// https://wiki.sourcefabric.org/display/CC/Adding+a+new+library+datatable+column
"aoColumns": cols,
"bProcessing": true,
"bServerSide": true,
"aLengthMenu": [25, 50, 100],
"bStateSave": true,
"fnStateSaveParams": function (oSettings, oData) {
// remove oData components we don't want to save.
@ -689,11 +699,13 @@ var AIRTIME = (function(AIRTIME) {
// add checkbox
$(nRow).find('td.library_checkbox').html("<input type='checkbox' name='cb_" + aData.id + "'>");
if (onDashboard) {
$(nRow).find('td.library_actions')
.text("...")
.on('click', function (e) {
$(this).contextMenu({x: $(e.target).offset().left, y: $(e.target).offset().top})
}).html("<div class='library_actions_btn'>...</div>");
}
// add audio preview image/button
if (aData.ftype === "audioclip") {
@ -1061,7 +1073,7 @@ var AIRTIME = (function(AIRTIME) {
});
// begin context menu initialization.
AIRTIME.library.ctxMenu = $.contextMenu({
AIRTIME.library.ctxMenu = !onDashboard ? {} : $.contextMenu({
selector: "#library_display tr[class*='lib']:has(td)",
//trigger: "left",
trigger: "custom",