Fix add/remove content dialog, try to increase speed of selection/deselection
This commit is contained in:
parent
a84c33f0ed
commit
0ad51dae09
5 changed files with 62 additions and 60 deletions
|
@ -320,24 +320,35 @@ var AIRTIME = (function(AIRTIME) {
|
|||
mod.checkToolBarIcons();
|
||||
};
|
||||
|
||||
mod.selectAll = function($els) {
|
||||
$els.each(function(i, el){
|
||||
mod.highlightItem(el);
|
||||
mod.addToChosen(el);
|
||||
});
|
||||
$previouslySelected = $els.last();
|
||||
mod.checkToolBarIcons();
|
||||
};
|
||||
|
||||
mod.deselectAll = function($els) {
|
||||
$els.each(function(i, el){
|
||||
mod.unHighlightItem(el);
|
||||
mod.removeFromChosen(el);
|
||||
});
|
||||
$previouslySelected = undefined;
|
||||
mod.checkToolBarIcons();
|
||||
};
|
||||
|
||||
/*
|
||||
* selects all items which the user can currently see. (behaviour taken from
|
||||
* gmail)
|
||||
*
|
||||
*
|
||||
* by default the items are selected in reverse order so we need to reverse
|
||||
* it back
|
||||
*/
|
||||
mod.selectCurrentPage = function() {
|
||||
$.fn.reverse = [].reverse;
|
||||
var $trs = $libTable.find("tbody").find("tr").reverse();
|
||||
|
||||
$trs.each(function(i, el){
|
||||
mod.selectItem($(el));
|
||||
mod.checkItem($(el));
|
||||
});
|
||||
|
||||
mod.checkToolBarIcons();
|
||||
|
||||
mod.selectAll($trs);
|
||||
};
|
||||
|
||||
/*
|
||||
|
@ -346,26 +357,13 @@ var AIRTIME = (function(AIRTIME) {
|
|||
*/
|
||||
mod.deselectCurrentPage = function() {
|
||||
var $trs = $libTable.find("tr");
|
||||
|
||||
$trs.each(function(i, el){
|
||||
mod.deselectItem($(el));
|
||||
mod.uncheckItem($(el));
|
||||
});
|
||||
|
||||
mod.checkToolBarIcons();
|
||||
mod.selectAll($trs);
|
||||
};
|
||||
|
||||
mod.selectNone = function() {
|
||||
var $trs = $libTable.find("tr");
|
||||
$trs.each(function(i, el){
|
||||
mod.deselectItem($(el));
|
||||
mod.uncheckItem($(el));
|
||||
});
|
||||
$previouslySelected = undefined;
|
||||
|
||||
chosenItems = {};
|
||||
|
||||
mod.checkToolBarIcons();
|
||||
mod.deselectAll($trs);
|
||||
};
|
||||
|
||||
mod.fnRedraw = function() {
|
||||
|
|
|
@ -125,20 +125,8 @@ function buildScheduleDialog (json, instance_id) {
|
|||
viewport = findViewportDimensions(),
|
||||
height = Math.floor(viewport.height * 0.96),
|
||||
width = Math.floor(viewport.width * 0.96),
|
||||
fnServer = AIRTIME.showbuilder.fnServerData,
|
||||
//subtract padding in pixels
|
||||
widgetWidth = width - 60,
|
||||
libWidth = Math.floor(widgetWidth * 0.5),
|
||||
builderWidth = Math.floor(widgetWidth * 0.5);
|
||||
|
||||
dialog.find("#library_content")
|
||||
.height(height - 115)
|
||||
.width(libWidth);
|
||||
|
||||
dialog.find("#show_builder")
|
||||
.height(height - 115)
|
||||
.width(builderWidth);
|
||||
|
||||
fnServer = AIRTIME.showbuilder.fnServerData;
|
||||
|
||||
dialog.dialog({
|
||||
autoOpen: false,
|
||||
title: json.title,
|
||||
|
@ -171,13 +159,6 @@ function buildScheduleDialog (json, instance_id) {
|
|||
AIRTIME.library.libraryInit();
|
||||
AIRTIME.showbuilder.builderDataTable();
|
||||
|
||||
//set max heights of datatables.
|
||||
dialog.find(".lib-content .dataTables_scrolling")
|
||||
.css("max-height", height - 90 - 200);
|
||||
|
||||
dialog.find(".sb-content .dataTables_scrolling")
|
||||
.css("max-height", height - 90 - 65);
|
||||
|
||||
dialog.dialog('open');
|
||||
}
|
||||
|
||||
|
@ -341,7 +322,6 @@ $(document).ready(function() {
|
|||
if (oItems.schedule !== undefined) {
|
||||
|
||||
callback = function() {
|
||||
|
||||
$.post(oItems.schedule.url, {format: "json", id: data.id}, function(json){
|
||||
buildScheduleDialog(json, data.id);
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue