Initial publishing fixes and tweaks

This commit is contained in:
Duncan Sommerville 2015-10-19 13:42:27 -04:00
parent be3a3fbd9f
commit c8069aaedd
5 changed files with 21 additions and 28 deletions

View file

@ -68,7 +68,7 @@ var AIRTIME = (function (AIRTIME) {
function _initAppFromResponse(data) {
var podcast = JSON.parse(data.podcast),
uid = AIRTIME.library.MediaTypeStringEnum.PODCAST+"_"+podcast.id,
tab = AIRTIME.tabs.openTab(data, uid, null),
tab = AIRTIME.tabs.openTab(data.html, uid, null),
table = mod.initPodcastEpisodeDatatable(podcast.episodes);
_bootstrapAngularApp(podcast, tab, table);
}

View file

@ -15,13 +15,13 @@ var AIRTIME = (function (AIRTIME) {
//AngularJS app
var publishApp = angular.module(PUBLISH_APP_NAME, [])
.controller('RestController', function($scope, $http, mediaId) {
.controller('RestController', function($scope, $http, mediaId, tab) {
$http.get(endpoint + mediaId, { csrf_token: jQuery("#csrf").val() })
.success(function(json) {
console.log(json);
$scope.media = json;
AIRTIME.tabs.setActiveTabName($scope.media.track_title);
tab.setName($scope.media.track_title);
});
$scope.save = function() {
@ -46,8 +46,9 @@ var AIRTIME = (function (AIRTIME) {
ids.push(el.id);
});*/
function _bootstrapAngularApp(mediaId) {
function _bootstrapAngularApp(mediaId, tab) {
publishApp.value('mediaId', mediaId);
publishApp.value('tab', tab);
var wrapper = AIRTIME.tabs.getActiveTab().contents.find(".editor_pane_wrapper");
wrapper.attr("ng-controller", "RestController");
angular.bootstrap(wrapper.get(0), [PUBLISH_APP_NAME]);
@ -75,10 +76,8 @@ var AIRTIME = (function (AIRTIME) {
jQuery.get(dialogUrl, { csrf_token: jQuery("#csrf").val() })
.success(function(html) {
var jsonWrapper = {'html' : html}; //Silly wrapper to make the openTab function happy
AIRTIME.tabs.openTab(jsonWrapper, mediaId);
_bootstrapAngularApp(mediaId);
var tab = AIRTIME.tabs.openTab(html, mediaId, null);
_bootstrapAngularApp(mediaId, tab);
});
/*

View file

@ -1074,7 +1074,7 @@ var AIRTIME = (function(AIRTIME){
{format: "json", type: 'playlist'},
function(json) {
var uid = AIRTIME.library.MediaTypeStringEnum.PLAYLIST+"_"+json.id;
AIRTIME.tabs.openTab(json, uid, AIRTIME.playlist._initPlaylistTabEvents);
AIRTIME.tabs.openTab(json.html, uid, AIRTIME.playlist._initPlaylistTabEvents);
redrawLib();
});
};
@ -1088,7 +1088,7 @@ var AIRTIME = (function(AIRTIME){
{format: "json"},
function(json) {
var uid = AIRTIME.library.MediaTypeStringEnum.WEBSTREAM+"_"+json.id;
AIRTIME.tabs.openTab(json, uid, AIRTIME.playlist._initPlaylistTabEvents);
AIRTIME.tabs.openTab(json.html, uid, AIRTIME.playlist._initPlaylistTabEvents);
redrawLib();
});
};
@ -1103,13 +1103,13 @@ var AIRTIME = (function(AIRTIME){
{format: "json", type: 'block'},
function(json){
var uid = AIRTIME.library.MediaTypeStringEnum.BLOCK+"_"+json.id;
AIRTIME.tabs.openTab(json, uid, AIRTIME.playlist._initPlaylistTabEvents);
AIRTIME.tabs.openTab(json.html, uid, AIRTIME.playlist._initPlaylistTabEvents);
redrawLib();
});
};
mod.fileMdEdit = function(json, uid) {
AIRTIME.tabs.openTab(json, uid, AIRTIME.playlist._initFileMdEvents);
AIRTIME.tabs.openTab(json.html, uid, AIRTIME.playlist._initFileMdEvents);
};
mod.fnEdit = function(id, type, url) {
@ -1120,7 +1120,7 @@ var AIRTIME = (function(AIRTIME){
{format: "json", id: id, type: type},
function(json) {
var uid = AIRTIME.library.MediaTypeFullToStringEnum.type+"_"+id;
AIRTIME.tabs.openTab(json, uid, AIRTIME.playlist._initPlaylistTabEvents);
AIRTIME.tabs.openTab(json.html, uid, AIRTIME.playlist._initPlaylistTabEvents);
redrawLib();
});
};
@ -1156,7 +1156,7 @@ var AIRTIME = (function(AIRTIME){
{format: "json", ids: id, modified: lastMod, type: type},
function(json){
var uid = AIRTIME.library.MediaTypeStringEnum.WEBSTREAM+"_"+id;
AIRTIME.tabs.openTab(json, uid, AIRTIME.playlist._initPlaylistTabEvents);
AIRTIME.tabs.openTab(json.html, uid, AIRTIME.playlist._initPlaylistTabEvents);
redrawLib();
});
};
@ -1204,7 +1204,7 @@ var AIRTIME = (function(AIRTIME){
mod.replaceForm = function(json){
$pl.find('.editor_pane_wrapper').html(json.html);
var uid = AIRTIME.library.MediaTypeStringEnum.BLOCK+"_"+json.id;
AIRTIME.tabs.openTab(json, uid, AIRTIME.playlist._initPlaylistTabEvents);
AIRTIME.tabs.openTab(json.html, uid, AIRTIME.playlist._initPlaylistTabEvents);
};