SAAS-1083 - Implement unpublishing
This commit is contained in:
parent
4b11979eff
commit
40a2aa10d8
3 changed files with 24 additions and 13 deletions
|
@ -29,7 +29,7 @@ class Application_Service_PublishService {
|
|||
public static function publish($fileId, $data) {
|
||||
foreach ($data as $k => $v) {
|
||||
$service = PublishServiceFactory::getService($k);
|
||||
if ($v) $service->publish($fileId);
|
||||
$service->$v($fileId);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -21,8 +21,8 @@
|
|||
<label for="{{source}}">{{label}}</label><br/>
|
||||
</div>
|
||||
<div ng-if="sources.toPublish.length == 0">
|
||||
<?php echo _("You have already published this track to all available sources!<br/>"
|
||||
. "Published tracks can be removed or updated below.") ?>
|
||||
<?php echo _("You have already published this track to all available sources!") . "<br/>"
|
||||
. _("Published tracks can be removed or updated below.") ?>
|
||||
</div>
|
||||
</fieldset>
|
||||
<fieldset>
|
||||
|
@ -33,8 +33,8 @@
|
|||
<button class="btn btn-small" ng-click="remove(source)"><?php echo _("Remove") ?></button>
|
||||
</div>
|
||||
<div ng-if="sources.published.length == 0">
|
||||
<?php echo _("You haven't published this track to any sources!<br/>"
|
||||
. "Check the boxes above and hit 'Publish' to publish this track to the marked sources.") ?>
|
||||
<?php echo _("You haven't published this track to any sources!") . "<br/>"
|
||||
. _("Check the boxes above and hit 'Publish' to publish this track to the marked sources.") ?>
|
||||
</div>
|
||||
</fieldset>
|
||||
</form>
|
||||
|
|
|
@ -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 () {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue