Reintroduce checkboxes

This commit is contained in:
Duncan Sommerville 2015-08-05 18:14:56 -04:00
parent 36f2e1844f
commit 4cbc49391b
5 changed files with 61 additions and 8 deletions

View File

@ -51,7 +51,7 @@
<div id="show_builder" class="sb-content content-pane wide-panel">
<div class="panel-header">
<ul class="nav nav-tabs">
<li id="timeline-tab" role="presentation" class="active"><a href="#">Timeline</a></li>
<li id="timeline-tab" role="presentation" class="active"><a href="#">Scheduled Shows</a></li>
</ul>
</div>
<div class="outer-datatable-wrapper active-tab">

View File

@ -233,6 +233,19 @@ div.ColVis_collectionBackground {
border: none;
}
/* Library Context Menu */
.context-menu-item.icon {
min-height: 26px;
padding: 0 5px;
background-position: 4px 5px;
}
.context-menu-item > span {
padding: 0 20px;
line-height: 26px;
}
/* Library Search */
#filter_options {
@ -297,6 +310,8 @@ div.ColVis_collectionBackground {
right: 4px;
left: 4px;
z-index: 1; /* Display above the content wrapper */
flex: 1 100%;
}
/* Timeline */
@ -389,7 +404,7 @@ div.ColVis_collectionBackground {
color: #efefef;
}
#side_playlist .zend_form dt {
#edit-md-dialog .zend_form dt {
float: left;
width: 40%;
@ -400,7 +415,7 @@ div.ColVis_collectionBackground {
padding-right: 4px;
}
#side_playlist .zend_form dd {
#edit-md-dialog .zend_form dd {
float: left;
width: auto;
@ -411,7 +426,7 @@ div.ColVis_collectionBackground {
/* Playlist/Block/Webstream Editors */
#side_playlist {
margin-top: 34px;
/*margin-top: 34px;*/
width: 100%; /* Override because we're using flexbox */
overflow-x: hidden;

View File

@ -507,8 +507,9 @@ var AIRTIME = (function(AIRTIME) {
// https://wiki.sourcefabric.org/display/CC/Adding+a+new+library+datatable+column
"aoColumns": [
/* ftype */ { "sTitle" : "" , "mDataProp" : "ftype" , "bSearchable" : false , "bVisible" : false } ,
/* Checkbox */ { "sTitle" : "" , "mDataProp" : "checkbox" , "bSortable" : false , "bSearchable" : false , "sWidth" : "10px" , "sClass" : "library_checkbox" } ,
/* Type */ { "sTitle" : "" , "mDataProp" : "image" , "bSearchable" : false , "sWidth" : "16px" , "sClass" : "library_type" , "iDataSort" : 0 } ,
///* Is Scheduled */ { "sTitle" : $.i18n._("Scheduled") , "mDataProp" : "is_scheduled" , "bVisible" : false , "bSearchable" : false , "sWidth" : "90px" , "sClass" : "library_is_scheduled"} ,
/* Is Scheduled */ { "sTitle" : $.i18n._("Scheduled") , "mDataProp" : "is_scheduled" , "bVisible" : false , "bSearchable" : false , "sWidth" : "90px" , "sClass" : "library_is_scheduled"} ,
///* Is Playlist */ { "sTitle" : $.i18n._("Playlist / Block") , "mDataProp" : "is_playlist" , "bSearchable" : false , "sWidth" : "110px" , "sClass" : "library_is_playlist"} ,
/* Title */ { "sTitle" : $.i18n._("Title") , "mDataProp" : "track_title" , "sClass" : "library_title" , "sWidth" : "170px" } ,
/* Creator */ { "sTitle" : $.i18n._("Creator") , "mDataProp" : "artist_name" , "sClass" : "library_creator" , "sWidth" : "160px" } ,
@ -636,6 +637,9 @@ var AIRTIME = (function(AIRTIME) {
},
"fnRowCallback": AIRTIME.library.fnRowCallback,
"fnCreatedRow": function( nRow, aData, iDataIndex ) {
// add checkbox
$(nRow).find('td.library_checkbox').html("<input type='checkbox' name='cb_"+aData.id+"'>");
// add audio preview image/button
if (aData.ftype === "audioclip") {
$(nRow).find('td.library_type').html('<img title="'+$.i18n._("Track preview")+'" src="'+baseUrl+'css/images/icon_audioclip.png">');
@ -759,9 +763,37 @@ var AIRTIME = (function(AIRTIME) {
AIRTIME.library.setupLibraryToolbar(oTable);
$libTable.find("tbody").on("click", ".library_checkbox", function(ev) {
var $cb = $(this),
$tr = $cb.parents("tr"),
// Get the ID of the selected row
$rowId = $tr.attr("id");
if (!$tr.hasClass(LIB_SELECTED_CLASS)) {
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);
}
});
$libTable.find("tbody").on("dblclick", "tr", function(ev) {
var $tr = $(this),
data = $tr.data("aData");
var data = $(this).data("aData");
AIRTIME.library.dblClickAdd(data, data.ftype);
});
@ -811,6 +843,7 @@ var AIRTIME = (function(AIRTIME) {
mod.selectItem($(this));
}
});
// begin context menu initialization.
$.contextMenu({
selector: '#library_display tr',
@ -1219,7 +1252,7 @@ $(document).ready(function() {
$(".media_type_selector").on("click", function() {
if (!$(this).hasClass("selected")) {
// TODO: deselect any highlighted items when we switch filtering
AIRTIME.library.selectNone();
$(".media_type_selector").each(function () {
$(this).removeClass("selected");
});

View File

@ -469,6 +469,7 @@ var AIRTIME = (function(AIRTIME){
function openPlaylist(json) {
$tabCount++;
console.log(json);
var tabId = $openTabs[json.id];
if ($openTabs[json.id] !== undefined) {
AIRTIME.showbuilder.switchTab($(".pl-tab-content-" + tabId), $("#pl-tab-" + tabId));
@ -1526,6 +1527,9 @@ var AIRTIME = (function(AIRTIME){
};
mod.onResize = function() {
var h = $(".panel-header .nav").height();
$(".pl-content").css("margin-top", h + 4); // 8px extra for padding
$("#show_builder_table_wrapper").css("top", h + 4);
};
return AIRTIME;

View File

@ -116,6 +116,7 @@ var AIRTIME = (function(AIRTIME){
if (tab.hasClass("pl-content")) {
AIRTIME.playlist.setAsActive();
}
AIRTIME.playlist.onResize();
};