SAAS-1083 - more work on publish dialog

This commit is contained in:
Duncan Sommerville 2015-10-29 14:58:30 -04:00
parent 706db9bc25
commit b4db2ff4ca
8 changed files with 111 additions and 34 deletions

View file

@ -19,16 +19,16 @@ var AIRTIME = (function (AIRTIME) {
$scope.publishSources = {};
function init () {
$http.get(endpoint + mediaId, { csrf_token: jQuery("#csrf").val() })
var csrfToken = jQuery("#csrf").val();
$http.get(endpoint + mediaId, { csrf_token: csrfToken })
.success(function (json) {
console.log(json);
$scope.media = json;
tab.setName($scope.media.track_title);
});
// Get an object containing all sources, their translated labels,
// and their publication state for the file with the given ID
$http.get(endpoint + mediaId + '/publish-sources', { csrf_token: jQuery("#csrf").val() })
$http.get(endpoint + mediaId + '/publish-sources', { csrf_token: csrfToken })
.success(function (json) {
$scope.sources = json;
// Store the data (whether each source should be published to when publish is clicked)
@ -40,6 +40,13 @@ var AIRTIME = (function (AIRTIME) {
});
}
$scope.openEditDialog = function() {
var uid = AIRTIME.library.MediaTypeStringEnum.FILE + "_" + mediaId;
$.get(baseUrl + "library/edit-file-md/id/" + mediaId, {format: "json"}, function (json) {
AIRTIME.playlist.fileMdEdit(json, uid);
});
};
$scope.publish = function () {
var data = {};
jQuery.each($scope.publishData, function(k, v) {
@ -131,6 +138,5 @@ var AIRTIME = (function (AIRTIME) {
});*/
};
return AIRTIME;
}(AIRTIME || {}));

View file

@ -1038,14 +1038,15 @@ var AIRTIME = (function(AIRTIME){
};
mod._initFileMdEvents = function(newTab) {
var fileId = newTab.wrapper.find('#file_id').val();
newTab.contents.find(".md-cancel").on("click", function() {
newTab.close();
});
newTab.contents.find(".md-save").on("click", function() {
var file_id = newTab.wrapper.find('#file_id').val(),
data = newTab.wrapper.find("#edit-md-dialog form").serializeArray();
$.post(baseUrl+'library/edit-file-md', {format: "json", id: file_id, data: data}, function() {
var data = newTab.wrapper.find(".edit-md-dialog form").serializeArray();
$.post(baseUrl+'library/edit-file-md', {format: "json", id: fileId, data: data}, function() {
// don't redraw the library table if we are on calendar page
// we would be on calendar if viewing recorded file metadata
if ($("#schedule_calendar").length === 0) {
@ -1056,7 +1057,11 @@ var AIRTIME = (function(AIRTIME){
newTab.close();
});
newTab.wrapper.find('#edit-md-dialog').on("keyup", function(event) {
newTab.contents.find(".md-publish").on("click", function() {
AIRTIME.publish.publishTrack(fileId);
});
newTab.wrapper.find('.edit-md-dialog').on("keyup", function(event) {
if (event.keyCode === 13) {
newTab.wrapper.find('.md-save').click();
}