CC-3463 : Usability of timeline
changing buttons to be jquery ui icons. adding button to trim overbooked adding button toscroll current item to top.
This commit is contained in:
parent
13bbdc327e
commit
711d1f202a
9 changed files with 223 additions and 150 deletions
|
@ -19,10 +19,10 @@ var AIRTIME = (function(AIRTIME){
|
|||
}
|
||||
|
||||
if (check === true) {
|
||||
AIRTIME.button.enableButton("library_group_add");
|
||||
AIRTIME.button.enableButton("lib-button-add");
|
||||
}
|
||||
else {
|
||||
AIRTIME.button.disableButton("library_group_add");
|
||||
AIRTIME.button.disableButton("lib-button-add");
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -76,43 +76,53 @@ var AIRTIME = (function(AIRTIME){
|
|||
});
|
||||
};
|
||||
|
||||
/*
|
||||
* @param oTable the datatables instance for the library.
|
||||
*/
|
||||
mod.setupLibraryToolbar = function( oLibTable ) {
|
||||
var aButtons,
|
||||
fnAddSelectedItems;
|
||||
mod.setupLibraryToolbar = function() {
|
||||
var $toolbar = $(".lib-content .fg-toolbar:first");
|
||||
|
||||
fnAddSelectedItems = function() {
|
||||
var oLibTT = TableTools.fnGetInstance('library_display'),
|
||||
aData = oLibTT.fnGetSelectedData(),
|
||||
i,
|
||||
temp,
|
||||
length,
|
||||
aMediaIds = [];
|
||||
|
||||
//process selected files/playlists.
|
||||
for (i = 0, length = aData.length; i < length; i++) {
|
||||
temp = aData[i];
|
||||
if (temp.ftype === "audioclip") {
|
||||
aMediaIds.push(temp.id);
|
||||
$toolbar
|
||||
.append("<ul />")
|
||||
.find('ul')
|
||||
.append('<li class="ui-state-default ui-state-disabled lib-button-add" title="add selected items to playlist"><span class="ui-icon ui-icon-plusthick"></span></li>')
|
||||
.append('<li class="ui-state-default ui-state-disabled lib-button-delete" title="delete selected items"><span class="ui-icon ui-icon-trash"></span></li>');
|
||||
|
||||
//add to playlist button
|
||||
$toolbar.find('.lib-button-add')
|
||||
.click(function() {
|
||||
|
||||
if (AIRTIME.button.isDisabled('lib-button-add') === true) {
|
||||
return;
|
||||
}
|
||||
|
||||
var oLibTT = TableTools.fnGetInstance('library_display'),
|
||||
aData = oLibTT.fnGetSelectedData(),
|
||||
i,
|
||||
temp,
|
||||
length,
|
||||
aMediaIds = [];
|
||||
|
||||
//process selected files/playlists.
|
||||
for (i = 0, length = aData.length; i < length; i++) {
|
||||
temp = aData[i];
|
||||
if (temp.ftype === "audioclip") {
|
||||
aMediaIds.push(temp.id);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
AIRTIME.playlist.fnAddItems(aMediaIds, undefined, 'after');
|
||||
};
|
||||
|
||||
//[0] = button text
|
||||
//[1] = id
|
||||
//[2] = enabled
|
||||
//[3] = click event
|
||||
aButtons = [["Delete", "library_group_delete", false, AIRTIME.library.fnDeleteSelectedItems],
|
||||
["Add", "library_group_add", false, fnAddSelectedItems]];
|
||||
AIRTIME.playlist.fnAddItems(aMediaIds, undefined, 'after');
|
||||
});
|
||||
|
||||
addToolBarButtonsLibrary(aButtons);
|
||||
//delete from library.
|
||||
$toolbar.find('.lib-button-delete')
|
||||
.click(function() {
|
||||
|
||||
if (AIRTIME.button.isDisabled('lib-button-delete') === true) {
|
||||
return;
|
||||
}
|
||||
|
||||
AIRTIME.library.fnDeleteSelectedItems();
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
return AIRTIME;
|
||||
|
||||
}(AIRTIME || {}));
|
||||
|
|
|
@ -19,10 +19,10 @@ var AIRTIME = (function(AIRTIME){
|
|||
}
|
||||
|
||||
if (check === true) {
|
||||
AIRTIME.button.enableButton("library_group_add");
|
||||
AIRTIME.button.enableButton("lib-button-add");
|
||||
}
|
||||
else {
|
||||
AIRTIME.button.disableButton("library_group_add");
|
||||
AIRTIME.button.disableButton("lib-button-add");
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -76,47 +76,61 @@ var AIRTIME = (function(AIRTIME){
|
|||
});
|
||||
};
|
||||
|
||||
mod.setupLibraryToolbar = function(oLibTable) {
|
||||
var aButtons,
|
||||
fnAddSelectedItems,
|
||||
mod.setupLibraryToolbar = function() {
|
||||
var $toolbar = $(".lib-content .fg-toolbar:first");
|
||||
|
||||
fnAddSelectedItems = function() {
|
||||
var oLibTT = TableTools.fnGetInstance('library_display'),
|
||||
aData = oLibTT.fnGetSelectedData(),
|
||||
i,
|
||||
length,
|
||||
temp,
|
||||
aMediaIds = [],
|
||||
aSchedIds = [];
|
||||
$toolbar
|
||||
.append("<ul />")
|
||||
.find('ul')
|
||||
.append('<li class="ui-state-default ui-state-disabled lib-button-add" title="add selected items to playlist"><span class="ui-icon ui-icon-plusthick"></span></li>')
|
||||
.append('<li class="ui-state-default ui-state-disabled lib-button-delete" title="delete selected items"><span class="ui-icon ui-icon-trash"></span></li>');
|
||||
|
||||
//add to timeline button
|
||||
$toolbar.find('.lib-button-add')
|
||||
.click(function() {
|
||||
|
||||
if (AIRTIME.button.isDisabled('lib-button-add') === true) {
|
||||
return;
|
||||
}
|
||||
|
||||
var oLibTT = TableTools.fnGetInstance('library_display'),
|
||||
aData = oLibTT.fnGetSelectedData(),
|
||||
i,
|
||||
length,
|
||||
temp,
|
||||
aMediaIds = [],
|
||||
aSchedIds = [];
|
||||
|
||||
//process selected files/playlists.
|
||||
for (i = 0, length = aData.length; i < length; i++) {
|
||||
temp = aData[i];
|
||||
aMediaIds.push({"id": temp.id, "type": temp.ftype});
|
||||
}
|
||||
|
||||
aData = [];
|
||||
$("#show_builder_table tr.cursor-selected-row").each(function(i, el){
|
||||
aData.push($(el).data("aData"));
|
||||
});
|
||||
|
||||
//process selected files/playlists.
|
||||
for (i = 0, length = aData.length; i < length; i++) {
|
||||
temp = aData[i];
|
||||
aMediaIds.push({"id": temp.id, "type": temp.ftype});
|
||||
}
|
||||
|
||||
aData = [];
|
||||
$("#show_builder_table tr.cursor-selected-row").each(function(i, el){
|
||||
aData.push($(el).data("aData"));
|
||||
//process selected schedule rows to add media after.
|
||||
for (i=0, length = aData.length; i < length; i++) {
|
||||
temp = aData[i];
|
||||
aSchedIds.push({"id": temp.id, "instance": temp.instance, "timestamp": temp.timestamp});
|
||||
}
|
||||
|
||||
AIRTIME.showbuilder.fnAdd(aMediaIds, aSchedIds);
|
||||
});
|
||||
|
||||
//process selected schedule rows to add media after.
|
||||
for (i=0, length = aData.length; i < length; i++) {
|
||||
temp = aData[i];
|
||||
aSchedIds.push({"id": temp.id, "instance": temp.instance, "timestamp": temp.timestamp});
|
||||
}
|
||||
|
||||
AIRTIME.showbuilder.fnAdd(aMediaIds, aSchedIds);
|
||||
};
|
||||
|
||||
//[0] = button text
|
||||
//[1] = id
|
||||
//[2] = enabled
|
||||
//[3] = click event
|
||||
aButtons = [["Delete", "library_group_delete", false, AIRTIME.library.fnDeleteSelectedItems],
|
||||
["Add", "library_group_add", false, fnAddSelectedItems]];
|
||||
|
||||
addToolBarButtonsLibrary(aButtons);
|
||||
//delete from library.
|
||||
$toolbar.find('.lib-button-delete')
|
||||
.click(function() {
|
||||
|
||||
if (AIRTIME.button.isDisabled('lib-button-delete') === true) {
|
||||
return;
|
||||
}
|
||||
|
||||
AIRTIME.library.fnDeleteSelectedItems();
|
||||
});
|
||||
};
|
||||
|
||||
return AIRTIME;
|
||||
|
|
|
@ -269,7 +269,7 @@ var AIRTIME = (function(AIRTIME) {
|
|||
}
|
||||
|
||||
//checking to enable buttons
|
||||
AIRTIME.button.enableButton("library_group_delete");
|
||||
AIRTIME.button.enableButton("lib-button-delete");
|
||||
AIRTIME.library.events.enableAddButtonCheck();
|
||||
},
|
||||
"fnRowDeselected": function ( node ) {
|
||||
|
@ -287,14 +287,13 @@ var AIRTIME = (function(AIRTIME) {
|
|||
|
||||
//checking to disable buttons
|
||||
if (selected.length === 0) {
|
||||
AIRTIME.button.disableButton("library_group_delete");
|
||||
AIRTIME.button.disableButton("lib-button-delete");
|
||||
}
|
||||
AIRTIME.library.events.enableAddButtonCheck();
|
||||
}
|
||||
},
|
||||
|
||||
"oColVis": {
|
||||
"buttonText": "Show/Hide Columns",
|
||||
"sAlign": "right",
|
||||
"aiExclude": [0, 1, 2],
|
||||
"sSize": "css"
|
||||
|
@ -497,48 +496,6 @@ var AIRTIME = (function(AIRTIME) {
|
|||
|
||||
}(AIRTIME || {}));
|
||||
|
||||
function addToolBarButtonsLibrary(aButtons) {
|
||||
var i,
|
||||
length = aButtons.length,
|
||||
libToolBar = $(".library_toolbar"),
|
||||
html,
|
||||
buttonClass = '',
|
||||
DEFAULT_CLASS = 'ui-button ui-state-default',
|
||||
DISABLED_CLASS = 'ui-state-disabled',
|
||||
fn;
|
||||
|
||||
for ( i = 0; i < length; i += 1 ) {
|
||||
buttonClass = '';
|
||||
|
||||
//add disabled class if not enabled.
|
||||
if (aButtons[i][2] === false) {
|
||||
buttonClass += DISABLED_CLASS;
|
||||
}
|
||||
|
||||
html = '<div class="ColVis TableTools '+aButtons[i][1]+'"><button class="'+DEFAULT_CLASS+' '+buttonClass+'"><span>'+aButtons[i][0]+'</span></button></div>';
|
||||
libToolBar.append(html);
|
||||
|
||||
//create a closure to preserve the state of i.
|
||||
(function(index){
|
||||
|
||||
libToolBar.find("."+aButtons[index][1]).click(function(){
|
||||
fn = function() {
|
||||
var $button = $(this).find("button");
|
||||
|
||||
//only call the passed function if the button is enabled.
|
||||
if (!$button.hasClass(DISABLED_CLASS)) {
|
||||
aButtons[index][3]();
|
||||
}
|
||||
};
|
||||
|
||||
fn.call(this);
|
||||
});
|
||||
|
||||
}(i));
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
function checkImportStatus(){
|
||||
$.getJSON('/Preference/is-import-in-progress', function(data){
|
||||
var div = $('#import_status');
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue