diff --git a/src/Umbraco.Web.UI.Client/src/common/directives/components/content/edit.controller.js b/src/Umbraco.Web.UI.Client/src/common/directives/components/content/edit.controller.js index a9e2616446..5bcab56f48 100644 --- a/src/Umbraco.Web.UI.Client/src/common/directives/components/content/edit.controller.js +++ b/src/Umbraco.Web.UI.Client/src/common/directives/components/content/edit.controller.js @@ -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 () { diff --git a/src/Umbraco.Web.UI.Client/src/less/application/grid.less b/src/Umbraco.Web.UI.Client/src/less/application/grid.less index 2671adba32..ff795d5ff4 100644 --- a/src/Umbraco.Web.UI.Client/src/less/application/grid.less +++ b/src/Umbraco.Web.UI.Client/src/less/application/grid.less @@ -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; diff --git a/src/Umbraco.Web.UI.Client/src/views/common/notifications/confirmunpublish.controller.js b/src/Umbraco.Web.UI.Client/src/views/common/notifications/confirmunpublish.controller.js new file mode 100644 index 0000000000..885df4b3a9 --- /dev/null +++ b/src/Umbraco.Web.UI.Client/src/views/common/notifications/confirmunpublish.controller.js @@ -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); + }; + + }); \ No newline at end of file diff --git a/src/Umbraco.Web.UI.Client/src/views/common/notifications/confirmunpublish.html b/src/Umbraco.Web.UI.Client/src/views/common/notifications/confirmunpublish.html new file mode 100644 index 0000000000..4bd3e2b964 --- /dev/null +++ b/src/Umbraco.Web.UI.Client/src/views/common/notifications/confirmunpublish.html @@ -0,0 +1,6 @@ +
+

Are you sure?

+

Unpublishing will remove this page and all its descendants from the site

+ + +
\ No newline at end of file diff --git a/src/Umbraco.Web.UI/umbraco/config/lang/en.xml b/src/Umbraco.Web.UI/umbraco/config/lang/en.xml index fb798c4d86..af7e8856d6 100644 --- a/src/Umbraco.Web.UI/umbraco/config/lang/en.xml +++ b/src/Umbraco.Web.UI/umbraco/config/lang/en.xml @@ -286,6 +286,7 @@ Discard changes You have unsaved changes Are you sure you want to navigate away from this page? - you have unsaved changes + Unpublishing will remove this page and all its descendants from the site. Done diff --git a/src/Umbraco.Web.UI/umbraco/config/lang/en_us.xml b/src/Umbraco.Web.UI/umbraco/config/lang/en_us.xml index 7cf0ce59bf..e5e1aaa317 100644 --- a/src/Umbraco.Web.UI/umbraco/config/lang/en_us.xml +++ b/src/Umbraco.Web.UI/umbraco/config/lang/en_us.xml @@ -286,6 +286,7 @@ Discard changes You have unsaved changes Are you sure you want to navigate away from this page? - you have unsaved changes + Unpublishing will remove this page and all its descendants from the site. Done