diff --git a/src/HC.PageNotFoundManager.Core/Backoffice/MenuRenderingNotificationHandler.cs b/src/HC.PageNotFoundManager.Core/Backoffice/MenuRenderingNotificationHandler.cs index 6b48408..9d89cae 100644 --- a/src/HC.PageNotFoundManager.Core/Backoffice/MenuRenderingNotificationHandler.cs +++ b/src/HC.PageNotFoundManager.Core/Backoffice/MenuRenderingNotificationHandler.cs @@ -37,7 +37,7 @@ public void Handle(MenuRenderingNotification notification) var menuItem = new MenuItem(Constants.MenuAlias, Constants.MenuLabel) { - Icon = "alert red", + Icon = "directions color-blue", SeparatorBefore = true }; diff --git a/src/HC.PageNotFoundManager.Core/Config/PageNotFoundConfig.cs b/src/HC.PageNotFoundManager.Core/Config/PageNotFoundConfig.cs index ea296bd..53575c3 100644 --- a/src/HC.PageNotFoundManager.Core/Config/PageNotFoundConfig.cs +++ b/src/HC.PageNotFoundManager.Core/Config/PageNotFoundConfig.cs @@ -2,8 +2,8 @@ using System.Collections.Generic; using System.Linq; using Umbraco.Cms.Core.Cache; -using Umbraco.Cms.Core.Scoping; using Umbraco.Cms.Core.Web; +using Umbraco.Cms.Infrastructure.Scoping; using Umbraco.Extensions; namespace HC.PageNotFoundManager.Core.Config diff --git a/src/HC.PageNotFoundManager.Core/ContentFinders/PageNotFoundFinder.cs b/src/HC.PageNotFoundManager.Core/ContentFinders/PageNotFoundFinder.cs index d1f8ac0..1a91b9a 100644 --- a/src/HC.PageNotFoundManager.Core/ContentFinders/PageNotFoundFinder.cs +++ b/src/HC.PageNotFoundManager.Core/ContentFinders/PageNotFoundFinder.cs @@ -23,7 +23,7 @@ public PageNotFoundFinder(IDomainService domainService, IUmbracoContextFactory u this.umbracoContextFactory = umbracoContextFactory ?? throw new ArgumentNullException(nameof(umbracoContextFactory)); this.config = config ?? throw new ArgumentNullException(nameof(config)); } - public bool TryFindContent(IPublishedRequestBuilder request) + public async Task TryFindContent(IPublishedRequestBuilder request) { var uri = request.AbsolutePathDecoded; diff --git a/src/HC.PageNotFoundManager.Core/HC.PageNotFoundManager.Core.csproj b/src/HC.PageNotFoundManager.Core/HC.PageNotFoundManager.Core.csproj index fd13b6b..850016f 100644 --- a/src/HC.PageNotFoundManager.Core/HC.PageNotFoundManager.Core.csproj +++ b/src/HC.PageNotFoundManager.Core/HC.PageNotFoundManager.Core.csproj @@ -1,11 +1,10 @@ - + 1.0.0 1.0.0 - beta-005 1.0.0 - net5.0 + net6.0 Nik Rimington . HotChilli.Umbraco.PageNotFound.Core @@ -23,11 +22,11 @@ - - - - - + + + + + diff --git a/src/HC.PageNotFoundManager.Core/Startup/UmbracoStartingNotificationHandler.cs b/src/HC.PageNotFoundManager.Core/Startup/UmbracoStartingNotificationHandler.cs index 855532c..19029bc 100644 --- a/src/HC.PageNotFoundManager.Core/Startup/UmbracoStartingNotificationHandler.cs +++ b/src/HC.PageNotFoundManager.Core/Startup/UmbracoStartingNotificationHandler.cs @@ -4,9 +4,9 @@ using Umbraco.Cms.Core.Events; using Umbraco.Cms.Core.Migrations; using Umbraco.Cms.Core.Notifications; -using Umbraco.Cms.Core.Scoping; using Umbraco.Cms.Core.Services; using Umbraco.Cms.Infrastructure.Migrations.Upgrade; +using Umbraco.Cms.Infrastructure.Scoping; namespace HC.PageNotFoundManager.Core.Startup { diff --git a/src/HC.PageNotFoundManager/App_Plugins/HC.PageNotFound/Backoffice/Dialogs/dialog.html b/src/HC.PageNotFoundManager/App_Plugins/HC.PageNotFound/Backoffice/Dialogs/dialog.html index fef4f63..b1838f3 100644 --- a/src/HC.PageNotFoundManager/App_Plugins/HC.PageNotFound/Backoffice/Dialogs/dialog.html +++ b/src/HC.PageNotFoundManager/App_Plugins/HC.PageNotFound/Backoffice/Dialogs/dialog.html @@ -1,12 +1,12 @@ 
-
+

Choose the 404 page for {{currentNode.name}} and child pages

-
+
@@ -17,14 +17,15 @@
- {{target.name}} is set as the 404 page for + No page{{target.name}} is set as the 404 page for {{currentNode.name}} and it's child pages

- Choose the 404 page for {{currentNode.name}} and child pages + The current 404 page for {{currentNode.name}} and child pages is show below.
+ Click the cross next to the page name to deselect the current node as the 404.

@@ -32,7 +33,7 @@
  • {{pageNotFoundNode.name}} - +
  • @@ -80,12 +81,20 @@
    - diff --git a/src/HC.PageNotFoundManager/App_Plugins/HC.PageNotFound/js/dialog.controller.js b/src/HC.PageNotFoundManager/App_Plugins/HC.PageNotFound/js/dialog.controller.js index 9217c93..454713d 100644 --- a/src/HC.PageNotFoundManager/App_Plugins/HC.PageNotFound/js/dialog.controller.js +++ b/src/HC.PageNotFoundManager/App_Plugins/HC.PageNotFound/js/dialog.controller.js @@ -3,6 +3,11 @@ function PageNotFoundManagerDialog($scope, pageNotFoundManagerResource, navigationService, userService, entityResource, iconHelper) { var node = $scope.currentNode; var vm = this; + vm.status = { + loaded: true, + busy: true, + existing: false + }; var initUserDetails; var initNotFound; $scope.nav = navigationService; @@ -27,7 +32,7 @@ $scope.treeModel.hideHeader = userData.startContentIds.length > 0 && userData.startContentIds.indexOf(-1) === -1; initUserDetails = true; - vm.busy = !(initNotFound && initUserDetails); + vm.status.busy = !(initNotFound && initUserDetails); }); pageNotFoundManagerResource.getNotFoundPage(node.id).then((resp) => { @@ -37,11 +42,12 @@ entityResource.getById(val, "Document").then(function (item) { item.icon = iconHelper.convertFromLegacyIcon(item.icon); $scope.pageNotFoundNode = item; + vm.status.existing = item != undefined; }); } - vm.loaded = true; + vm.status.loaded = true; initNotFound = true; - vm.busy = !(initNotFound && initUserDetails); + vm.status.busy = !(initNotFound && initUserDetails); }); vm.close = close; @@ -96,29 +102,36 @@ $scope.setNotFoundPage = function () { - vm.busy = true; + vm.status.busy = true; $scope.error = false; var parentId = 0; if (node !== null) parentId = node.id; - var notFoundPageId = 0; + var notFoundPageId = $scope.pageNotFoundId; if ($scope.target !== undefined && $scope.target !== null) notFoundPageId = $scope.target.id; - pageNotFoundManagerResource.setNotFoundPage(parentId, notFoundPageId).then(function () { - $scope.error = false; - $scope.success = true; - vm.busy = false; - }, function (err) { - $scope.success = false; - $scope.error = err; - vm.busy = false; - }); + if(notFoundPageId != $scope.pageNotFoundId || notFoundPageId == 0 ) + pageNotFoundManagerResource.setNotFoundPage(parentId, notFoundPageId).then(function () { + $scope.error = false; + $scope.success = true; + vm.status.busy = false; + }, function (err) { + $scope.success = false; + $scope.error = err; + vm.status.busy = false; + }); + else + close(); }; - $scope.clear = () => $scope.pageNotFoundNode = null; + $scope.clear = function() { + $scope.pageNotFoundNode = null; + vm.status.existing = false; + $scope.pageNotFoundId = 0; + } function treeLoadedHandler() { if ($scope.source && $scope.source.path) { diff --git a/src/HC.PageNotFoundManager/HC.PageNotFoundManager.csproj b/src/HC.PageNotFoundManager/HC.PageNotFoundManager.csproj index 2afb465..96dd7b6 100644 --- a/src/HC.PageNotFoundManager/HC.PageNotFoundManager.csproj +++ b/src/HC.PageNotFoundManager/HC.PageNotFoundManager.csproj @@ -3,9 +3,8 @@ 1.0.0 1.0.0 - beta-005 1.0.0 - net5.0 + net6.0 Nik Rimington . HotChilli.Umbraco.PageNotFound @@ -39,6 +38,6 @@ - +