Skip to content

Commit

Permalink
Merge pull request #21 from NikRimington/develop
Browse files Browse the repository at this point in the history
[RELEASE] 2.0.0
  • Loading branch information
NikRimington authored Jun 21, 2022
2 parents da5462e + b12cd0d commit 9d7f1e5
Show file tree
Hide file tree
Showing 8 changed files with 62 additions and 42 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<bool> TryFindContent(IPublishedRequestBuilder request)
{

var uri = request.AbsolutePathDecoded;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<AssemblyVersion>1.0.0</AssemblyVersion>
<Version>1.0.0</Version>
<VersionSuffix>beta-005</VersionSuffix>
<InformationalVersion>1.0.0</InformationalVersion>
<TargetFramework>net5.0</TargetFramework>
<TargetFramework>net6.0</TargetFramework>
<Authors>Nik Rimington</Authors>
<ContentTargetFolders>.</ContentTargetFolders>
<Product>HotChilli.Umbraco.PageNotFound.Core</Product>
Expand All @@ -23,11 +22,11 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Umbraco.Cms.Core" Version="9.0.0-rc003" />
<PackageReference Include="Umbraco.Cms.Infrastructure" Version="9.0.0-rc003" />
<PackageReference Include="Umbraco.Cms.Web.BackOffice" Version="9.0.0-rc003" />
<PackageReference Include="Umbraco.Cms.Web.Common" Version="9.0.0-rc003" />
<PackageReference Include="Umbraco.Cms.Web.Website" Version="9.0.0-rc003" />
<PackageReference Include="Umbraco.Cms.Core" Version="10.0.0" />
<PackageReference Include="Umbraco.Cms.Infrastructure" Version="10.0.0" />
<PackageReference Include="Umbraco.Cms.Web.BackOffice" Version="10.0.0" />
<PackageReference Include="Umbraco.Cms.Web.Common" Version="10.0.0" />
<PackageReference Include="Umbraco.Cms.Web.Website" Version="10.0.0" />
</ItemGroup>
<ItemGroup>
<None Include="../../docs/img/logo.png" Pack="true" PackPath="\" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
<div ng-controller="hc.pagenotfound.dialog.controller as vm">
<div class="umb-dialog-body" ng-cloak>
<div class="umb-pane" ng-show="vm.busy || !vm.loaded">
<div class="umb-pane" ng-show="vm.status.busy || !vm.status.loaded">
<p class="abstract">
Choose the 404 page for <strong>{{currentNode.name}}</strong> and child pages
</p>
<umb-load-indicator></umb-load-indicator>
</div>
<div class="umb-pane" ng-hide="!vm.loaded">
<div class="umb-pane" ng-hide="!vm.status.loaded">

<div ng-show="error">
<div class="alert alert-error">
Expand All @@ -17,22 +17,23 @@

<div ng-show="success">
<div class="alert alert-success">
<strong>{{target.name}}</strong> is set as the 404 page for
<span ng-show="target == undefined">No page</span><strong ng-hide="target == undefined">{{target.name}}</strong> is set as the 404 page for
<strong>{{currentNode.name}}</strong> and it's child pages
</div>
<button class="btn btn-primary" ng-click="vm.close()">Ok</button>
</div>

<p class="abstract" ng-hide="success">
Choose the 404 page for <strong>{{currentNode.name}}</strong> and child pages
The current 404 page for <strong>{{currentNode.name}}</strong> and child pages is show below. <br/>
<em>Click the cross next to the page name to deselect the current node as the 404.</em>
</p>

<div ng-if="pageNotFoundNode">
<ul class="unstyled list-icons">
<li>
<em class="icon {{pageNotFoundNode.icon}} hover-hide"></em>
<a>{{pageNotFoundNode.name}}</a>
<a ng-click="clear()"><em class="icon red icon-delete"></em></a>
<a ng-click="clear()" title="Remove selected 404"><em class="icon red icon-delete"></em></a>
</li>
</ul>
</div>
Expand Down Expand Up @@ -80,12 +81,20 @@
</div>
</div>

<div class="umb-dialog-footer btn-toolbar umb-btn-toolbar" ng-hide="success || busy">
<a class="btn btn-link" ng-click="vm.close()">
<localize key="general_cancel">Cancel</localize>
</a>
<button class="btn btn-primary" ng-click="setNotFoundPage()">
<localize key="general_ok">OK</localize>
</button>
<div class="umb-dialog-footer btn-toolbar umb-btn-toolbar">
<div ng-hide="vm.status.existing || success || busy">
<a class="btn btn-link" ng-click="vm.close()">
<localize key="general_cancel">Cancel</localize>
</a>
<button class="btn btn-primary" ng-click="setNotFoundPage()">
<localize key="general_ok">Save</localize>
</button>
</div>
<div ng-show="vm.status.existing">
<button class="btn btn-primary" ng-click="vm.close()">
<localize key="general_ok">OK</localize>
</button>
</div>
</div>

</div>
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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) => {
Expand All @@ -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;
Expand Down Expand Up @@ -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) {
Expand Down
5 changes: 2 additions & 3 deletions src/HC.PageNotFoundManager/HC.PageNotFoundManager.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,8 @@
<PropertyGroup>
<AssemblyVersion>1.0.0</AssemblyVersion>
<Version>1.0.0</Version>
<VersionSuffix>beta-005</VersionSuffix>
<InformationalVersion>1.0.0</InformationalVersion>
<TargetFramework>net5.0</TargetFramework>
<TargetFramework>net6.0</TargetFramework>
<Authors>Nik Rimington</Authors>
<ContentTargetFolders>.</ContentTargetFolders>
<Product>HotChilli.Umbraco.PageNotFound</Product>
Expand Down Expand Up @@ -39,6 +38,6 @@
<None Include="../../LICENSE" Pack="true" PackPath="" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Umbraco.Cms.Core" Version="9.0.0-rc003" />
<PackageReference Include="Umbraco.Cms.Core" Version="10.0.0" />
</ItemGroup>
</Project>

0 comments on commit 9d7f1e5

Please sign in to comment.