From bf9a3363446cd5f397dd3cc989187ffd99e3994c Mon Sep 17 00:00:00 2001 From: Nathan Woulfe Date: Thu, 28 Jun 2018 10:12:40 +1000 Subject: [PATCH 1/4] correct notifications positioning on smaller screens - was hidden behind the left nav --- .../src/less/application/grid.less | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) 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; From 70aeb1c09dd7f4df776ed73d88cdc4b56dd6a887 Mon Sep 17 00:00:00 2001 From: Nathan Woulfe Date: Thu, 28 Jun 2018 10:13:01 +1000 Subject: [PATCH 2/4] add en variants for unpublish notification --- src/Umbraco.Web.UI/umbraco/config/lang/en.xml | 1 + src/Umbraco.Web.UI/umbraco/config/lang/en_us.xml | 1 + 2 files changed, 2 insertions(+) diff --git a/src/Umbraco.Web.UI/umbraco/config/lang/en.xml b/src/Umbraco.Web.UI/umbraco/config/lang/en.xml index 93d8e8b0f6..ee7cb8483b 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 15256505a9..1344bebd09 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 From 7aa47f32c4660a91b7afe00827ecb6440b2f3569 Mon Sep 17 00:00:00 2001 From: Nathan Woulfe Date: Thu, 28 Jun 2018 10:19:26 +1000 Subject: [PATCH 3/4] new notification view + controller for confirming unpublish --- .../common/notifications/confirmunpublish.controller.js | 9 +++++++++ .../src/views/common/notifications/confirmunpublish.html | 6 ++++++ 2 files changed, 15 insertions(+) create mode 100644 src/Umbraco.Web.UI.Client/src/views/common/notifications/confirmunpublish.controller.js create mode 100644 src/Umbraco.Web.UI.Client/src/views/common/notifications/confirmunpublish.html 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 From ee0888e58c33ffcee27b2e91e84daca9b02bfeb4 Mon Sep 17 00:00:00 2001 From: Nathan Woulfe Date: Thu, 28 Jun 2018 10:21:41 +1000 Subject: [PATCH 4/4] updates to make it all work - event from the notification determines the action --- .../components/content/edit.controller.js | 63 +++++++++++-------- 1 file changed, 38 insertions(+), 25 deletions(-) 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 () {