Merge branch 'saas-dev' into saas-dev-publishing
Conflicts: airtime_mvc/public/css/dashboard.css airtime_mvc/public/css/styles.css airtime_mvc/public/js/airtime/library/library.js airtime_mvc/public/js/airtime/library/spl.js
This commit is contained in:
commit
c3c4abdd0c
31 changed files with 427 additions and 206 deletions
|
@ -88,13 +88,19 @@ function getDatatablesStrings(overrideDict) {
|
|||
"sSearch": $.i18n._(""),
|
||||
"sZeroRecords": $.i18n._("No matching records found"),
|
||||
"oPaginate": {
|
||||
"sFirst": $.i18n._("First"),
|
||||
"sLast": $.i18n._("Last"),
|
||||
"sNext": $.i18n._("Next"),
|
||||
"sPrevious": $.i18n._("Previous")
|
||||
"sFirst": "«",
|
||||
"sLast": "»",
|
||||
"sNext": "›",
|
||||
"sPrevious": "‹"
|
||||
},
|
||||
//"oPaginate": {
|
||||
// "sFirst": $.i18n._("First"),
|
||||
// "sLast": $.i18n._("Last"),
|
||||
// "sNext": $.i18n._("Next"),
|
||||
// "sPrevious": $.i18n._("Previous")
|
||||
//},
|
||||
"oAria": {
|
||||
"sSortAscending": $.i18n._(": activate to sort column ascending"),
|
||||
"sSortAscending": $.i18n._(": activate to sort column ascending"),
|
||||
"sSortDescending": $.i18n._(": activate to sort column descending")
|
||||
}
|
||||
};
|
||||
|
@ -317,4 +323,4 @@ jQuery.fn.textScroll = function(selector) {
|
|||
});
|
||||
|
||||
return this; // jQuery chaining
|
||||
};
|
||||
};
|
||||
|
|
|
@ -18,6 +18,7 @@ var AIRTIME = (function(AIRTIME) {
|
|||
check = true;
|
||||
}
|
||||
|
||||
var sortable = $(".spl_sortable");
|
||||
if ($("#show_builder_table").is(":visible")) {
|
||||
if (shows.length === 0) {
|
||||
check = false;
|
||||
|
@ -28,13 +29,15 @@ var AIRTIME = (function(AIRTIME) {
|
|||
} else if (current.length !== 0) {
|
||||
btnText = $.i18n._('Add to current show');
|
||||
}
|
||||
} else {
|
||||
} else if (sortable.length > 0 && sortable.is(":visible")) {
|
||||
var objType = $('.active-tab .obj_type').val();
|
||||
if (objType === 'block') {
|
||||
btnText = $.i18n._('Add to current smart block');
|
||||
} else {
|
||||
btnText = $.i18n._('Add to current playlist');
|
||||
}
|
||||
} else {
|
||||
check = false;
|
||||
}
|
||||
|
||||
if (check) {
|
||||
|
@ -100,86 +103,95 @@ var AIRTIME = (function(AIRTIME) {
|
|||
libEmpty.hide();
|
||||
}
|
||||
|
||||
var sortable;
|
||||
|
||||
if ($("#show_builder_table").is(":visible")) {
|
||||
$('#library_display tr[class*="lib-"]')
|
||||
.draggable(
|
||||
{
|
||||
helper: function () {
|
||||
|
||||
var $el = $(this), selected = mod
|
||||
.getChosenItemsLength(), container, thead = $("#show_builder_table thead"), colspan = thead
|
||||
.find("th").length, width = $el.width(), message;
|
||||
|
||||
// dragging an element that has an unselected
|
||||
// checkbox.
|
||||
if (mod.isChosenItem($el) === false) {
|
||||
selected++;
|
||||
}
|
||||
|
||||
if (selected === 1) {
|
||||
message = $.i18n._("Adding 1 Item");
|
||||
} else {
|
||||
message = sprintf($.i18n._("Adding %s Items"), selected);
|
||||
}
|
||||
|
||||
container = $('<div/>').attr('id',
|
||||
'draggingContainer').append('<tr/>')
|
||||
.find("tr").append('<td/>').find("td")
|
||||
.attr("colspan", colspan).width(width)
|
||||
.addClass("ui-state-highlight").append(
|
||||
message).end().end();
|
||||
|
||||
return container;
|
||||
},
|
||||
cursor: 'move',
|
||||
//cursorAt: {
|
||||
// top: 30,
|
||||
// right: 10
|
||||
//},
|
||||
distance: 25, // min-distance for dragging
|
||||
connectToSortable: '#show_builder_table'
|
||||
});
|
||||
sortable = "#show_builder_table";
|
||||
} else {
|
||||
$('#library_display tr[class*="lib-"]')
|
||||
.draggable(
|
||||
{
|
||||
helper: function () {
|
||||
|
||||
var $el = $(this), selected = mod
|
||||
.getChosenAudioFilesLength(), container, message,
|
||||
width = $(this).width(), height = 55;
|
||||
|
||||
// dragging an element that has an unselected
|
||||
// checkbox.
|
||||
if (mod.isChosenItem($el) === false) {
|
||||
selected++;
|
||||
}
|
||||
|
||||
if (selected === 1) {
|
||||
message = $.i18n._("Adding 1 Item");
|
||||
} else {
|
||||
message = sprintf($.i18n._("Adding %s Items"), selected);
|
||||
}
|
||||
|
||||
container = $('<div class="helper"/>').append(
|
||||
"<li/>").find("li").addClass(
|
||||
"ui-state-default").append("<div/>")
|
||||
.find("div").addClass(
|
||||
"list-item-container").append(
|
||||
message).end().width(width)
|
||||
.height(height).end();
|
||||
|
||||
return container;
|
||||
},
|
||||
cursor: 'move',
|
||||
//cursorAt: {
|
||||
// top: 30,
|
||||
// right: 10
|
||||
//},
|
||||
distance: 25, // min-distance for dragging
|
||||
connectToSortable: '.active-tab .spl_sortable'
|
||||
});
|
||||
sortable = ".active-tab .spl_sortable";
|
||||
//$('#library_display tr[class*="lib-"]')
|
||||
// .draggable(
|
||||
// {
|
||||
// helper: function () {
|
||||
//
|
||||
// var $el = $(this), selected = mod
|
||||
// .getChosenAudioFilesLength(), container, message,
|
||||
// width = $(this).width(), height = 55;
|
||||
//
|
||||
// // dragging an element that has an unselected
|
||||
// // checkbox.
|
||||
// if (mod.isChosenItem($el) === false) {
|
||||
// selected++;
|
||||
// }
|
||||
//
|
||||
// if (selected === 1) {
|
||||
// message = $.i18n._("Adding 1 Item");
|
||||
// } else {
|
||||
// message = sprintf($.i18n._("Adding %s Items"), selected);
|
||||
// }
|
||||
//
|
||||
// container = $('<div class="helper"/>').append(
|
||||
// "<li/>").find("li").addClass(
|
||||
// "ui-state-default").append("<div/>")
|
||||
// .find("div").addClass(
|
||||
// "list-item-container").append(
|
||||
// message).end().width(width)
|
||||
// .height(height).end();
|
||||
//
|
||||
// return container;
|
||||
// },
|
||||
// create: function(event, ui) {
|
||||
// $(this).draggable("option", "cursorAt", {
|
||||
// left: Math.floor(this.clientWidth / 2)
|
||||
// });
|
||||
// },
|
||||
// cursor: 'move',
|
||||
// distance: 25, // min-distance for dragging
|
||||
// connectToSortable: '.active-tab .spl_sortable'
|
||||
// });
|
||||
}
|
||||
|
||||
$('#library_display tr[class*="lib-"]')
|
||||
.draggable(
|
||||
{
|
||||
helper: function () {
|
||||
|
||||
var $el = $(this), selected = mod
|
||||
.getChosenItemsLength(), container, thead = $("#show_builder_table thead"), colspan = thead
|
||||
.find("th").length, width = $el.width(), message;
|
||||
|
||||
// dragging an element that has an unselected
|
||||
// checkbox.
|
||||
if (mod.isChosenItem($el) === false) {
|
||||
selected++;
|
||||
}
|
||||
|
||||
if (selected === 1) {
|
||||
message = $.i18n._("Adding 1 Item");
|
||||
} else {
|
||||
message = sprintf($.i18n._("Adding %s Items"), selected);
|
||||
}
|
||||
|
||||
container = $('<div/>').attr('id',
|
||||
'draggingContainer').append('<tr/>')
|
||||
.find("tr").append('<td/>').find("td")
|
||||
.attr("colspan", colspan).width(width)
|
||||
.addClass("ui-state-highlight").append(
|
||||
message).end().end();
|
||||
|
||||
return container;
|
||||
},
|
||||
create: function(event, ui) {
|
||||
$(this).draggable("option", "cursorAt", {
|
||||
top: 20,
|
||||
left: Math.floor($(this).outerWidth() / 2)
|
||||
});
|
||||
},
|
||||
tolerance: 'pointer',
|
||||
cursor: 'move',
|
||||
distance: 25, // min-distance for dragging
|
||||
connectToSortable: sortable
|
||||
});
|
||||
};
|
||||
|
||||
mod.dblClickAdd = function(data, type) {
|
||||
|
|
|
@ -847,12 +847,6 @@ var AIRTIME = (function(AIRTIME) {
|
|||
return getDatatablesStrings({
|
||||
"sEmptyTable": $.i18n._(""),
|
||||
"sZeroRecords": $.i18n._("No matching results found.")
|
||||
//"oPaginate": {
|
||||
// "sFirst": "<<",
|
||||
// "sLast": ">>",
|
||||
// "sNext": ">",
|
||||
// "sPrevious": "<"
|
||||
//}
|
||||
});
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -20,6 +20,7 @@ $(document).ready(function () {
|
|||
acceptedFiles: acceptedMimeTypes.join(),
|
||||
addRemoveLinks: true,
|
||||
dictRemoveFile: $.i18n._("Remove"),
|
||||
maxFilesize: 500, //Megabytes
|
||||
init: function () {
|
||||
this.on("sending", function (file, xhr, data) {
|
||||
data.append("csrf_token", $("#csrf").val());
|
||||
|
|
|
@ -18,6 +18,7 @@ var AIRTIME = (function (AIRTIME) {
|
|||
//when you're creating a new podcast, we already have the object from the result of the POST. We're saving
|
||||
//a roundtrip by not fetching it again here.
|
||||
$scope.podcast = podcast;
|
||||
console.log(podcast);
|
||||
tab.setName($scope.podcast.title);
|
||||
|
||||
$scope.savePodcast = function() {
|
||||
|
@ -25,7 +26,6 @@ var AIRTIME = (function (AIRTIME) {
|
|||
podcastData.episodes = episodeTable.getSelectedRows();
|
||||
$http.put(endpoint + $scope.podcast.id, { csrf_token: jQuery("#csrf").val(), podcast: podcastData })
|
||||
.success(function() {
|
||||
// TODO refresh the table here somehow..
|
||||
episodeTable.reload($scope.podcast.id);
|
||||
});
|
||||
};
|
||||
|
@ -39,12 +39,16 @@ var AIRTIME = (function (AIRTIME) {
|
|||
function _bulkAction(method, callback) {
|
||||
var ids = [], selectedData = AIRTIME.library.podcastTableWidget.getSelectedRows();
|
||||
selectedData.forEach(function(el) {
|
||||
var uid = AIRTIME.library.MediaTypeStringEnum.PODCAST+"_"+el.id;
|
||||
var t = AIRTIME.tabs.get(uid);
|
||||
var uid = AIRTIME.library.MediaTypeStringEnum.PODCAST+"_"+el.id,
|
||||
t = AIRTIME.tabs.get(uid);
|
||||
if (t && method == HTTPMethods.DELETE) {
|
||||
t.close();
|
||||
}
|
||||
if (!(t && method == HTTPMethods.GET)) ids.push(el.id);
|
||||
if (!(t && method == HTTPMethods.GET)) {
|
||||
ids.push(el.id);
|
||||
} else if (t != AIRTIME.tabs.getActiveTab()) {
|
||||
t.switchTo();
|
||||
}
|
||||
});
|
||||
|
||||
if (ids.length > 0) {
|
||||
|
@ -62,6 +66,14 @@ var AIRTIME = (function (AIRTIME) {
|
|||
angular.bootstrap(wrapper.get(0), ["podcast"]);
|
||||
}
|
||||
|
||||
function _initAppFromResponse(data) {
|
||||
var podcast = JSON.parse(data.podcast),
|
||||
uid = AIRTIME.library.MediaTypeStringEnum.PODCAST+"_"+podcast.id,
|
||||
tab = AIRTIME.tabs.openTab(data, uid, null),
|
||||
table = mod.initPodcastEpisodeDatatable(podcast.episodes);
|
||||
_bootstrapAngularApp(podcast, tab, table);
|
||||
}
|
||||
|
||||
mod.createUrlDialog = function() {
|
||||
$.get('/render/podcast-url-dialog', function(json) {
|
||||
$(document.body).append(json.html);
|
||||
|
@ -77,11 +89,7 @@ var AIRTIME = (function (AIRTIME) {
|
|||
|
||||
mod.addPodcast = function() {
|
||||
$.post(endpoint, $("#podcast_url_dialog").find("form").serialize(), function(json) {
|
||||
var podcast = JSON.parse(json.podcast);
|
||||
var uid = AIRTIME.library.MediaTypeStringEnum.PODCAST+"_"+podcast.id,
|
||||
tab = AIRTIME.tabs.openTab(json, uid, null);
|
||||
var table = mod.initPodcastEpisodeDatatable(podcast.episodes);
|
||||
_bootstrapAngularApp(podcast, tab, table);
|
||||
_initAppFromResponse(json);
|
||||
$("#podcast_url_dialog").dialog("close");
|
||||
});
|
||||
};
|
||||
|
@ -89,11 +97,7 @@ var AIRTIME = (function (AIRTIME) {
|
|||
mod.editSelectedPodcasts = function() {
|
||||
_bulkAction(HTTPMethods.GET, function(json) {
|
||||
json.forEach(function(data) {
|
||||
var podcast = JSON.parse(data.podcast);
|
||||
var uid = AIRTIME.library.MediaTypeStringEnum.PODCAST+"_"+podcast.id,
|
||||
tab = AIRTIME.tabs.openTab(data, uid, null);
|
||||
var table = mod.initPodcastEpisodeDatatable(podcast.episodes);
|
||||
_bootstrapAngularApp(podcast, tab, table);
|
||||
_initAppFromResponse(data);
|
||||
});
|
||||
});
|
||||
};
|
||||
|
@ -140,7 +144,6 @@ var AIRTIME = (function (AIRTIME) {
|
|||
});
|
||||
};
|
||||
|
||||
// This method is static, so use AIRTIME.widgets.Table
|
||||
var podcastToolbarButtons = AIRTIME.widgets.Table.getStandardToolbarButtons();
|
||||
|
||||
// Set up the div with id "podcast_table" as a datatable.
|
||||
|
|
|
@ -224,7 +224,7 @@ function buildScheduleDialog (json, instance_id) {
|
|||
}
|
||||
]
|
||||
});
|
||||
|
||||
|
||||
//set the start end times so the builder datatables knows its time range.
|
||||
fnServer.start = json.start;
|
||||
fnServer.end = json.end;
|
||||
|
|
|
@ -766,7 +766,7 @@ var AIRTIME = (function(AIRTIME){
|
|||
"bScrollCollapseY": false
|
||||
});
|
||||
|
||||
$sbTable.find("tbody").on("mousedown", "tr:not(.sb-header, .sb-footer, .sb-past, .sb-empty, :has(td.dataTables_empty)) > td.sb-checkbox", function(ev) {
|
||||
$sbTable.find("tbody").on("mousedown", "tr:not(.sb-not-allowed, .sb-header, .sb-footer, .sb-past, .sb-empty, :has(td.dataTables_empty)) > td.sb-checkbox", function(ev) {
|
||||
var $tr = $(this).parent(),
|
||||
// Get the ID of the selected row
|
||||
$rowId = $tr.attr("id");
|
||||
|
@ -803,7 +803,7 @@ var AIRTIME = (function(AIRTIME){
|
|||
$previouslySelected = $tr;
|
||||
});
|
||||
|
||||
$sbTable.find("tbody").on("mousedown", "tr:not(.sb-header, .sb-footer, .sb-past, .sb-empty, :has(td.dataTables_empty)) > td:not(.sb-checkbox)", function(ev) {
|
||||
$sbTable.find("tbody").on("mousedown", "tr:not(.sb-not-allowed, .sb-header, .sb-footer, .sb-past, .sb-empty, :has(td.dataTables_empty)) > td:not(.sb-checkbox)", function(ev) {
|
||||
var $tr = $(this).parent(),
|
||||
// Get the ID of the selected row
|
||||
$rowId = $tr.attr("id");
|
||||
|
@ -851,7 +851,7 @@ var AIRTIME = (function(AIRTIME){
|
|||
$previouslySelected = $tr;
|
||||
});
|
||||
|
||||
$sbTable.find("tbody").on("click", "tr:not(.sb-header, .sb-footer, .sb-past, .sb-empty, :has(td.dataTables_empty)) > td.sb-checkbox", function() {
|
||||
$sbTable.find("tbody").on("click", "tr:not(.sb-not-allowed, .sb-header, .sb-footer, .sb-past, .sb-empty, :has(td.dataTables_empty)) > td.sb-checkbox", function() {
|
||||
var tr = $(this).parent();
|
||||
if (flagForDeselection) {
|
||||
flagForDeselection = false;
|
||||
|
@ -867,7 +867,7 @@ var AIRTIME = (function(AIRTIME){
|
|||
selectedRows = $("." + SB_SELECTED_CLASS);
|
||||
});
|
||||
|
||||
$sbTable.find("tbody").on("click", "tr:not(.sb-header, .sb-footer, .sb-past, .sb-empty, :has(td.dataTables_empty)) > td:not(.sb-checkbox)", function(e) {
|
||||
$sbTable.find("tbody").on("click", "tr:not(.sb-not-allowed, .sb-header, .sb-footer, .sb-past, .sb-empty, :has(td.dataTables_empty)) > td:not(.sb-checkbox)", function(e) {
|
||||
var tr = $(this).parent();
|
||||
if (flagForDeselection) {
|
||||
flagForDeselection = false;
|
||||
|
@ -887,7 +887,7 @@ var AIRTIME = (function(AIRTIME){
|
|||
|
||||
//begin context menu initialization.
|
||||
$.contextMenu({
|
||||
selector: '#show_builder tr.lib-audio:not(.sb-past)',
|
||||
selector: '#show_builder tr.lib-audio:not(.sb-not-allowed, .sb-past)',
|
||||
trigger: "right",
|
||||
|
||||
build: function($el, e) {
|
||||
|
|
|
@ -93,7 +93,7 @@ AIRTIME = (function(AIRTIME) {
|
|||
check;
|
||||
|
||||
check = validateTimeRange();
|
||||
|
||||
|
||||
if (check.isValid) {
|
||||
//reset timestamp value since input values could have changed.
|
||||
AIRTIME.showbuilder.resetTimestamp();
|
||||
|
@ -102,14 +102,15 @@ AIRTIME = (function(AIRTIME) {
|
|||
fn.start = check.start;
|
||||
fn.end = check.end;
|
||||
|
||||
op = $("div.sb-advanced-options");
|
||||
op = $("div.sb-options-form");
|
||||
if (op.is(":visible")) {
|
||||
|
||||
if (fn.ops === undefined) {
|
||||
fn.ops = {};
|
||||
}
|
||||
fn.ops.showFilter = op.find("#sb_show_filter").val();
|
||||
fn.ops.myShows = op.find("#sb_my_shows").is(":checked") ? 1 : 0;
|
||||
// Hacky?
|
||||
fn.ops.myShows = (fn.ops.showFilter == -1) ? 1 : 0;
|
||||
}
|
||||
|
||||
oTable.fnDraw();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue