Merge pull request #2731 from nathanwoulfe/temp-U4-9379
U4 9379 - add confirmation step to unpublish action
This commit is contained in:
@@ -201,39 +201,52 @@
|
||||
}
|
||||
|
||||
|
||||
$scope.unPublish = function () {
|
||||
$scope.unPublish = function () {
|
||||
// raising the event triggers the confirmation dialog
|
||||
if (!notificationsService.hasView()) {
|
||||
notificationsService.add({ view: "confirmunpublish" });
|
||||
}
|
||||
|
||||
$scope.page.buttonGroupState = "busy";
|
||||
|
||||
if (formHelper.submitForm({ scope: $scope, statusMessage: "Unpublishing...", skipValidation: true })) {
|
||||
// actioning the dialog raises the confirmUnpublish event, act on it here
|
||||
var actioned = $rootScope.$on("content.confirmUnpublish", function(event, confirmed) {
|
||||
if (confirmed && formHelper.submitForm({ scope: $scope, statusMessage: "Unpublishing...", skipValidation: true })) {
|
||||
|
||||
eventsService.emit("content.unpublishing", { content: $scope.content });
|
||||
|
||||
$scope.page.buttonGroupState = "busy";
|
||||
contentResource.unPublish($scope.content.id)
|
||||
.then(function (data) {
|
||||
|
||||
eventsService.emit("content.unpublishing", { content: $scope.content });
|
||||
formHelper.resetForm({ scope: $scope, notifications: data.notifications });
|
||||
|
||||
contentResource.unPublish($scope.content.id)
|
||||
.then(function (data) {
|
||||
contentEditingHelper.handleSuccessfulSave({
|
||||
scope: $scope,
|
||||
savedContent: data,
|
||||
rebindCallback: contentEditingHelper.reBindChangedProperties($scope.content, data)
|
||||
});
|
||||
|
||||
formHelper.resetForm({ scope: $scope, notifications: data.notifications });
|
||||
init($scope.content);
|
||||
|
||||
contentEditingHelper.handleSuccessfulSave({
|
||||
scope: $scope,
|
||||
savedContent: data,
|
||||
rebindCallback: contentEditingHelper.reBindChangedProperties($scope.content, data)
|
||||
});
|
||||
syncTreeNode($scope.content, data.path);
|
||||
|
||||
init($scope.content);
|
||||
|
||||
syncTreeNode($scope.content, data.path);
|
||||
|
||||
$scope.page.buttonGroupState = "success";
|
||||
|
||||
eventsService.emit("content.unpublished", { content: $scope.content });
|
||||
|
||||
}, function(err) {
|
||||
formHelper.showNotifications(err.data);
|
||||
$scope.page.buttonGroupState = 'error';
|
||||
});
|
||||
}
|
||||
$scope.page.buttonGroupState = "success";
|
||||
eventsService.emit("content.unpublished", { content: $scope.content });
|
||||
|
||||
}, function(err) {
|
||||
formHelper.showNotifications(err.data);
|
||||
$scope.page.buttonGroupState = 'error';
|
||||
});
|
||||
|
||||
} else {
|
||||
$scope.page.buttonGroupState = "init";
|
||||
}
|
||||
|
||||
// unsubscribe to avoid queueing notifications
|
||||
// listener is re-bound when the unpublish button is clicked so it is created just-in-time
|
||||
actioned();
|
||||
|
||||
});
|
||||
};
|
||||
|
||||
$scope.sendToPublish = function () {
|
||||
|
||||
@@ -248,13 +248,13 @@ body.umb-drawer-is-visible #mainwrapper{
|
||||
#applications-tray {
|
||||
left: 60px;
|
||||
}
|
||||
#navigation {
|
||||
#navigation, #umb-notifications-wrapper {
|
||||
left: 60px;
|
||||
}
|
||||
#contentwrapper, #contentcolumn, #umb-notifications-wrapper {
|
||||
#contentwrapper, #contentcolumn {
|
||||
left: 30px;
|
||||
}
|
||||
#umbracoMainPageBody .umb-modal-left.fade.in {
|
||||
#umbracoMainPageBody .umb-modal-left.fade.in {
|
||||
margin-left: 61px;
|
||||
}
|
||||
}
|
||||
@@ -277,12 +277,13 @@ body.umb-drawer-is-visible #mainwrapper{
|
||||
#applications-tray {
|
||||
left: 40px;
|
||||
}
|
||||
#navigation {
|
||||
#navigation, #umb-notifications-wrapper {
|
||||
left: 40px;
|
||||
}
|
||||
#contentwrapper, #contentcolumn, #umb-notifications-wrapper {
|
||||
#contentwrapper, #contentcolumn {
|
||||
left: 20px;
|
||||
}
|
||||
|
||||
#umbracoMainPageBody .umb-modal-left.fade.in {
|
||||
margin-left: 41px;
|
||||
width: 85%!important;
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
angular.module("umbraco").controller("Umbraco.Notifications.ConfirmUnpublishController",
|
||||
function ($scope, notificationsService, eventsService) {
|
||||
|
||||
$scope.confirm = function(not, action){
|
||||
eventsService.emit('content.confirmUnpublish', action);
|
||||
notificationsService.remove(not);
|
||||
};
|
||||
|
||||
});
|
||||
@@ -0,0 +1,6 @@
|
||||
<div ng-controller="Umbraco.Notifications.ConfirmUnpublishController">
|
||||
<h4><localize key="general_areyousure">Are you sure?</localize></h4>
|
||||
<p><localize key="prompt_confirmUnpublish">Unpublishing will remove this page and all its descendants from the site</localize></p>
|
||||
<button class="btn btn-warning" ng-click="confirm(notification, true)"><localize key="actions_unpublish">Unpublish</localize></button>
|
||||
<button class="btn btn-default" ng-click="confirm(notification, false)" umb-auto-focus><localize key="general_cancel">Cancel</localize></button>
|
||||
</div>
|
||||
Reference in New Issue
Block a user