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:
Duncan Sommerville 2015-09-30 16:26:02 -04:00
commit c3c4abdd0c
31 changed files with 427 additions and 206 deletions

View file

@ -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) {

View file

@ -847,12 +847,6 @@ var AIRTIME = (function(AIRTIME) {
return getDatatablesStrings({
"sEmptyTable": $.i18n._(""),
"sZeroRecords": $.i18n._("No matching results found.")
//"oPaginate": {
// "sFirst": "<<",
// "sLast": ">>",
// "sNext": ">",
// "sPrevious": "<"
//}
});
break;
}

View file

@ -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());

View file

@ -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.