SAAS-1083 - Implement unpublishing

This commit is contained in:
Duncan Sommerville 2015-10-29 13:09:50 -04:00
parent 4b11979eff
commit 40a2aa10d8
3 changed files with 24 additions and 13 deletions

View file

@ -41,17 +41,28 @@ var AIRTIME = (function (AIRTIME) {
}
$scope.publish = function () {
$http.put(endpoint + mediaId + '/publish',
{
csrf_token: jQuery("#csrf").val(),
sources: $scope.publishData
}).success(function () {
init();
});
var data = {};
jQuery.each($scope.publishData, function(k, v) {
if (v) {
data[k] = 'publish'; // FIXME: should be more robust
}
});
if (Object.keys(data).length > 0) {
$http.put(endpoint + mediaId + '/publish', { csrf_token: jQuery("#csrf").val(), sources: data})
.success(function () {
init();
});
}
};
$scope.remove = function (source) {
// TODO
var data = {};
data[source] = 'unpublish'; // FIXME: should be more robust
$http.put(endpoint + mediaId + '/publish', { csrf_token: jQuery("#csrf").val(), sources: data })
.success(function () {
init();
});
};
$scope.discard = function () {