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
|
@ -539,14 +539,16 @@ class NewPlaylistController extends Zend_Controller_Action
|
||||||
$result['html'] = $this->createFullResponse($bl, true, true);
|
$result['html'] = $this->createFullResponse($bl, true, true);
|
||||||
$result['result'] = 0;
|
$result['result'] = 0;
|
||||||
} else {
|
} else {
|
||||||
$this->view->obj = $bl;
|
|
||||||
$this->view->id = $bl->getId();
|
|
||||||
$this->view->form = $form;
|
$this->view->form = $form;
|
||||||
$this->view->unsavedName = $params['name'];
|
$this->view->unsavedName = $params['name'];
|
||||||
$this->view->unsavedDesc = $params['description'];
|
$this->view->unsavedDesc = $params['description'];
|
||||||
$viewPath = 'playlist/_smart-block.phtml';
|
$viewPath = 'playlist/_smart-block.phtml';
|
||||||
|
$this->view->obj = $bl;
|
||||||
|
$this->view->id = $bl->getId();
|
||||||
$result['html'] = $this->view->render($viewPath);
|
$result['html'] = $this->view->render($viewPath);
|
||||||
$result['result'] = 1;
|
$result['result'] = 1;
|
||||||
|
$result['type'] = "sb";
|
||||||
|
$result['id'] = $bl->getId();
|
||||||
}
|
}
|
||||||
} else if ($params['type'] == 'playlist') {
|
} else if ($params['type'] == 'playlist') {
|
||||||
$this->setPlaylistNameDescAction();
|
$this->setPlaylistNameDescAction();
|
||||||
|
|
|
@ -549,8 +549,6 @@ textarea {
|
||||||
|
|
||||||
flex: 1 auto;
|
flex: 1 auto;
|
||||||
padding: 0;
|
padding: 0;
|
||||||
/*margin-right: 10px;*/
|
|
||||||
/*text-align: center;*/
|
|
||||||
|
|
||||||
background: #353535;
|
background: #353535;
|
||||||
border: 1px solid #242424;
|
border: 1px solid #242424;
|
||||||
|
@ -663,15 +661,19 @@ textarea {
|
||||||
text-align: center;
|
text-align: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
th.library_checkbox {
|
||||||
|
text-align: center !important;
|
||||||
|
}
|
||||||
|
|
||||||
.datatable tr td { /*, .datatable tr th {*/
|
.datatable tr td { /*, .datatable tr th {*/
|
||||||
line-height: 28px;
|
line-height: 28px;
|
||||||
font-size: 14px;
|
font-size: 14px;
|
||||||
padding: 5px;
|
padding: 5px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.datatable tr[class$='selected'] td,
|
.datatable tr[class*='selected'] td,
|
||||||
.datatable tr.sb-now-playing td {
|
.datatable tr.sb-now-playing td {
|
||||||
color: #efefef;
|
color: #000;
|
||||||
}
|
}
|
||||||
|
|
||||||
.datatable tr, .datatable td,
|
.datatable tr, .datatable td,
|
||||||
|
@ -687,6 +689,11 @@ textarea {
|
||||||
position: fixed !important;
|
position: fixed !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.datatable .ui-state-highlight, .spl_sortable .ui-state-highlight {
|
||||||
|
background: rgba(255, 93, 26, .6);
|
||||||
|
border: none;
|
||||||
|
}
|
||||||
|
|
||||||
/* Uploads/Dropzone */
|
/* Uploads/Dropzone */
|
||||||
|
|
||||||
#upload_form {
|
#upload_form {
|
||||||
|
|
|
@ -287,10 +287,14 @@ var AIRTIME = (function(AIRTIME) {
|
||||||
|
|
||||||
mod.checkItem = function($el) {
|
mod.checkItem = function($el) {
|
||||||
$el.find(".library_checkbox > input").prop('checked', true);
|
$el.find(".library_checkbox > input").prop('checked', true);
|
||||||
|
$("#super-checkbox").prop("checked", true);
|
||||||
};
|
};
|
||||||
|
|
||||||
mod.uncheckItem = function($el) {
|
mod.uncheckItem = function($el) {
|
||||||
$el.find(".library_checkbox > input").prop('checked', false);
|
$el.find(".library_checkbox > input").prop('checked', false);
|
||||||
|
if ($("." + LIB_SELECTED_CLASS.length == 0)) {
|
||||||
|
$("#super-checkbox").prop("checked", false);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
mod.highlightItem = function($el) {
|
mod.highlightItem = function($el) {
|
||||||
|
@ -362,20 +366,23 @@ var AIRTIME = (function(AIRTIME) {
|
||||||
mod.checkToolBarIcons();
|
mod.checkToolBarIcons();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
mod.fnRedraw = function() {
|
||||||
|
oTable.fnStandingRedraw();
|
||||||
|
};
|
||||||
|
|
||||||
mod.fnDeleteItems = function(aMedia) {
|
mod.fnDeleteItems = function(aMedia) {
|
||||||
//Prevent the user from spamming the delete button while the AJAX request is in progress
|
//Prevent the user from spamming the delete button while the AJAX request is in progress
|
||||||
AIRTIME.button.disableButton("btn-group #sb-trash", false);
|
AIRTIME.button.disableButton("btn-group #sb-trash", false);
|
||||||
var openTabObjectIds = $(".obj_id"),
|
var openTabObjectIds = $(".obj_id"),
|
||||||
mediaIds = [];
|
mediaIds = [];
|
||||||
for (var i in aMedia) {
|
for (var i in aMedia) {
|
||||||
mediaIds.push(aMedia[i].id.toString());
|
mediaIds.push(parseInt(aMedia[i].id));
|
||||||
}
|
}
|
||||||
|
|
||||||
openTabObjectIds.each(function(i, el) {
|
openTabObjectIds.each(function(i, el) {
|
||||||
var v = $(el).val();
|
var v = parseInt($(el).val());
|
||||||
if ($.inArray(v, mediaIds) > -1) {
|
if ($.inArray(v, mediaIds) > -1) {
|
||||||
AIRTIME.playlist.fnOpenPlaylist({id: v});
|
AIRTIME.playlist.closeTab($(el).closest(".pl-content").attr("tab-id"));
|
||||||
AIRTIME.playlist.closeTab();
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -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.
|
// begin context menu initialization.
|
||||||
$.contextMenu({
|
$.contextMenu({
|
||||||
selector: '#library_display tr',
|
selector: '#library_display tr:has(td)',
|
||||||
trigger: "right",
|
trigger: "right",
|
||||||
|
|
||||||
build: function($el, e) {
|
build: function($el, e) {
|
||||||
|
|
|
@ -443,7 +443,7 @@ var AIRTIME = (function(AIRTIME){
|
||||||
}
|
}
|
||||||
$tabCount++;
|
$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),
|
t = $("#show_builder").append(wrapper).find("#pl-tab-content-" + $tabCount),
|
||||||
pane = $(".editor_pane_wrapper:last"),
|
pane = $(".editor_pane_wrapper:last"),
|
||||||
name = json.type == "md" ? // file
|
name = json.type == "md" ? // file
|
||||||
|
@ -514,20 +514,21 @@ var AIRTIME = (function(AIRTIME){
|
||||||
$("#pl_edit").hide();
|
$("#pl_edit").hide();
|
||||||
}
|
}
|
||||||
|
|
||||||
function closeTab() {
|
function closeTab(id) {
|
||||||
var pane = $(".active-tab"),
|
var pane = id ? $(".pl-content[tab-id='" + id + "']") : $(".active-tab"),
|
||||||
tab = $(".nav.nav-tabs .active"),
|
tab = id ? $(".nav.nav-tabs [tab-id='" + id + "']") : $(".nav.nav-tabs .active"),
|
||||||
toPane = pane.next().length > 0 ? pane.next() : pane.prev(),
|
toPane = pane.next().length > 0 ? pane.next() : pane.prev(),
|
||||||
toTab = tab.next().length > 0 ? tab.next() : tab.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];
|
delete $openTabs[tab.attr("tab-type") + objId];
|
||||||
|
|
||||||
tab.remove();
|
tab.remove();
|
||||||
$pl.remove();
|
$pl.remove();
|
||||||
AIRTIME.showbuilder.switchTab(toPane, toTab);
|
AIRTIME.showbuilder.switchTab(toPane, toTab);
|
||||||
}
|
}
|
||||||
|
|
||||||
mod.closeTab = function() {
|
mod.closeTab = function(id) {
|
||||||
closeTab();
|
closeTab(id);
|
||||||
};
|
};
|
||||||
|
|
||||||
//Purpose of this function is to iterate over all playlist elements
|
//Purpose of this function is to iterate over all playlist elements
|
||||||
|
@ -967,6 +968,7 @@ var AIRTIME = (function(AIRTIME){
|
||||||
alert(json.error);
|
alert(json.error);
|
||||||
}
|
}
|
||||||
if (json.html !== undefined) {
|
if (json.html !== undefined) {
|
||||||
|
console.log(json);
|
||||||
closeTab();
|
closeTab();
|
||||||
openPlaylist(json);
|
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
|
//http://stackoverflow.com/questions/2150002/jquery-ui-sortable-how-can-i-change-the-appearance-of-the-placeholder-object
|
||||||
placeholder: {
|
placeholder: {
|
||||||
element: function(currentItem) {
|
element: function(currentItem) {
|
||||||
|
|
||||||
return $('<li class="placeholder ui-state-highlight"></li>')[0];
|
return $('<li class="placeholder ui-state-highlight"></li>')[0];
|
||||||
},
|
},
|
||||||
update: function(container, p) {
|
update: function(container, p) {
|
||||||
|
@ -1071,10 +1072,12 @@ var AIRTIME = (function(AIRTIME){
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
forcePlaceholderSize: true,
|
forcePlaceholderSize: true,
|
||||||
handle: 'div.list-item-container',
|
//handle: 'div.list-item-container',
|
||||||
start: function(event, ui) {
|
start: function(event, ui) {
|
||||||
ui.placeholder.height(56);
|
ui.placeholder.height(56);
|
||||||
},
|
},
|
||||||
|
axis: "y",
|
||||||
|
containment: "document",
|
||||||
receive: fnReceive,
|
receive: fnReceive,
|
||||||
update: fnUpdate
|
update: fnUpdate
|
||||||
};
|
};
|
||||||
|
|
|
@ -70,6 +70,11 @@ var AIRTIME = (function(AIRTIME) {
|
||||||
mod.redrawChosen();
|
mod.redrawChosen();
|
||||||
mod.checkToolBarIcons();
|
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")) {
|
if ($("#show_builder_table").is(":visible")) {
|
||||||
$('#library_display tr.lib-audio, tr.lib-pl, tr.lib-stream')
|
$('#library_display tr.lib-audio, tr.lib-pl, tr.lib-stream')
|
||||||
.draggable(
|
.draggable(
|
||||||
|
@ -116,9 +121,8 @@ var AIRTIME = (function(AIRTIME) {
|
||||||
helper: function () {
|
helper: function () {
|
||||||
|
|
||||||
var $el = $(this), selected = mod
|
var $el = $(this), selected = mod
|
||||||
.getChosenAudioFilesLength(), container, message, li = $(".side_playlist.active-tab ul.spl_sortable li:first"),
|
.getChosenAudioFilesLength(), container, message,
|
||||||
width = li.width(), height = 55;
|
width = $(this).width(), height = 55;
|
||||||
if (width > 798) width = 798;
|
|
||||||
|
|
||||||
// dragging an element that has an unselected
|
// dragging an element that has an unselected
|
||||||
// checkbox.
|
// checkbox.
|
||||||
|
|
|
@ -119,6 +119,7 @@ var AIRTIME = (function(AIRTIME){
|
||||||
AIRTIME.playlist.setAsActive();
|
AIRTIME.playlist.setAsActive();
|
||||||
}
|
}
|
||||||
AIRTIME.playlist.onResize();
|
AIRTIME.playlist.onResize();
|
||||||
|
AIRTIME.library.fnRedraw();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -822,6 +823,7 @@ var AIRTIME = (function(AIRTIME){
|
||||||
$(this).find(".sb-checkbox > input").prop('checked', true);
|
$(this).find(".sb-checkbox > input").prop('checked', true);
|
||||||
}
|
}
|
||||||
selectedRows = $("." + SB_SELECTED_CLASS);
|
selectedRows = $("." + SB_SELECTED_CLASS);
|
||||||
|
mod.checkToolBarIcons();
|
||||||
});
|
});
|
||||||
|
|
||||||
//begin context menu initialization.
|
//begin context menu initialization.
|
||||||
|
@ -1017,7 +1019,7 @@ var AIRTIME = (function(AIRTIME){
|
||||||
return {
|
return {
|
||||||
placeholder: "sb-placeholder ui-state-highlight",
|
placeholder: "sb-placeholder ui-state-highlight",
|
||||||
//forcePlaceholderSize: true,
|
//forcePlaceholderSize: true,
|
||||||
distance: 10,
|
distance: 25,
|
||||||
helper:
|
helper:
|
||||||
function(event, item) {
|
function(event, item) {
|
||||||
var selected = mod.getSelectedData(NOW_PLAYING_CLASS),
|
var selected = mod.getSelectedData(NOW_PLAYING_CLASS),
|
||||||
|
@ -1069,6 +1071,8 @@ var AIRTIME = (function(AIRTIME){
|
||||||
cancel: '.sb-footer',
|
cancel: '.sb-footer',
|
||||||
receive: fnReceive,
|
receive: fnReceive,
|
||||||
update: fnUpdate,
|
update: fnUpdate,
|
||||||
|
axis: "y",
|
||||||
|
containment: "document",
|
||||||
start: function(event, ui) {
|
start: function(event, ui) {
|
||||||
var elements = $sbTable.find('tr.'+SB_SELECTED_CLASS).not("."+NOW_PLAYING_CLASS);
|
var elements = $sbTable.find('tr.'+SB_SELECTED_CLASS).not("."+NOW_PLAYING_CLASS);
|
||||||
elements.hide();
|
elements.hide();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue