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) {
|
public static function publish($fileId, $data) {
|
||||||
foreach ($data as $k => $v) {
|
foreach ($data as $k => $v) {
|
||||||
$service = PublishServiceFactory::getService($k);
|
$service = PublishServiceFactory::getService($k);
|
||||||
if ($v) $service->publish($fileId);
|
$service->$v($fileId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -21,8 +21,8 @@
|
||||||
<label for="{{source}}">{{label}}</label><br/>
|
<label for="{{source}}">{{label}}</label><br/>
|
||||||
</div>
|
</div>
|
||||||
<div ng-if="sources.toPublish.length == 0">
|
<div ng-if="sources.toPublish.length == 0">
|
||||||
<?php echo _("You have already published this track to all available sources!<br/>"
|
<?php echo _("You have already published this track to all available sources!") . "<br/>"
|
||||||
. "Published tracks can be removed or updated below.") ?>
|
. _("Published tracks can be removed or updated below.") ?>
|
||||||
</div>
|
</div>
|
||||||
</fieldset>
|
</fieldset>
|
||||||
<fieldset>
|
<fieldset>
|
||||||
|
@ -33,8 +33,8 @@
|
||||||
<button class="btn btn-small" ng-click="remove(source)"><?php echo _("Remove") ?></button>
|
<button class="btn btn-small" ng-click="remove(source)"><?php echo _("Remove") ?></button>
|
||||||
</div>
|
</div>
|
||||||
<div ng-if="sources.published.length == 0">
|
<div ng-if="sources.published.length == 0">
|
||||||
<?php echo _("You haven't published this track to any sources!<br/>"
|
<?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.") ?>
|
. _("Check the boxes above and hit 'Publish' to publish this track to the marked sources.") ?>
|
||||||
</div>
|
</div>
|
||||||
</fieldset>
|
</fieldset>
|
||||||
</form>
|
</form>
|
||||||
|
|
|
@ -41,17 +41,28 @@ var AIRTIME = (function (AIRTIME) {
|
||||||
}
|
}
|
||||||
|
|
||||||
$scope.publish = function () {
|
$scope.publish = function () {
|
||||||
$http.put(endpoint + mediaId + '/publish',
|
var data = {};
|
||||||
{
|
jQuery.each($scope.publishData, function(k, v) {
|
||||||
csrf_token: jQuery("#csrf").val(),
|
if (v) {
|
||||||
sources: $scope.publishData
|
data[k] = 'publish'; // FIXME: should be more robust
|
||||||
}).success(function () {
|
}
|
||||||
init();
|
});
|
||||||
});
|
|
||||||
|
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) {
|
$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 () {
|
$scope.discard = function () {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue