Skip to content

Commit

Permalink
[FIX] Update the JS for closing the dialogues and fix wrong service b…
Browse files Browse the repository at this point in the history
…eing injected

 - [FIX] Correct injected service to be Navigation service instead of notification service
 - [AMEND] Change close trigger bindings
 - [UPGRADE] Upgrade to RC2 dependency
 - [FIX] Back office icon not showing
 - [ISSUES] #1
  • Loading branch information
NikRimington committed Aug 20, 2021
1 parent 1b0f795 commit 82ae042
Show file tree
Hide file tree
Showing 6 changed files with 32 additions and 21 deletions.
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2021 Bjarke Berg
Copyright (c) 2021 Nik Rimington

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
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 = Umbraco.Cms.Core.Constants.Icons.Content,
Icon = "alert red",
SeparatorBefore = true
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
<PropertyGroup>
<AssemblyVersion>1.0.0</AssemblyVersion>
<Version>1.0.0</Version>
<VersionSuffix>beta-004</VersionSuffix>
<InformationalVersion>1.0.0</InformationalVersion>
<TargetFramework>net5.0</TargetFramework>
<Authors>Nik Rimington</Authors>
Expand All @@ -22,11 +23,11 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Umbraco.Cms.Core" Version="9.0.0-rc001" />
<PackageReference Include="Umbraco.Cms.Infrastructure" Version="9.0.0-rc001" />
<PackageReference Include="Umbraco.Cms.Web.BackOffice" Version="9.0.0-rc001" />
<PackageReference Include="Umbraco.Cms.Web.Common" Version="9.0.0-rc001" />
<PackageReference Include="Umbraco.Cms.Web.Website" Version="9.0.0-rc001" />
<PackageReference Include="Umbraco.Cms.Core" Version="9.0.0-rc002" />
<PackageReference Include="Umbraco.Cms.Infrastructure" Version="9.0.0-rc002" />
<PackageReference Include="Umbraco.Cms.Web.BackOffice" Version="9.0.0-rc002" />
<PackageReference Include="Umbraco.Cms.Web.Common" Version="9.0.0-rc002" />
<PackageReference Include="Umbraco.Cms.Web.Website" Version="9.0.0-rc002" />
</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 @@ -20,7 +20,7 @@
<strong>{{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="nav.hideDialog()">Ok</button>
<button class="btn btn-primary" ng-click="vm.close()">Ok</button>
</div>

<p class="abstract" ng-hide="success">
Expand Down Expand Up @@ -49,7 +49,7 @@
section="{{section}}">
</umb-tree-search-box>

<br/>
<br />

<umb-tree-search-results ng-if="searchInfo.showSearch"
results="searchInfo.results"
Expand Down Expand Up @@ -81,7 +81,7 @@
</div>

<div class="umb-dialog-footer btn-toolbar umb-btn-toolbar" ng-hide="success || busy">
<a class="btn btn-link" ng-click="nav.hideDialog()">
<a class="btn btn-link" ng-click="vm.close()">
<localize key="general_cancel">Cancel</localize>
</a>
<button class="btn btn-primary" ng-click="setNotFoundPage()">
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
(function() {
(function () {
"use strict";
function PageNotFoundManagerDialog($scope, pageNotFoundManagerResource, navigationService, userService, entityResource, iconHelper) {
var node = $scope.currentNode;
Expand Down Expand Up @@ -34,7 +34,7 @@
const val = parseInt(resp.data);
if (!isNaN(val) && angular.isNumber(val) && val > 0) {
$scope.pageNotFoundId = val;
entityResource.getById(val, "Document").then(function(item) {
entityResource.getById(val, "Document").then(function (item) {
item.icon = iconHelper.convertFromLegacyIcon(item.icon);
$scope.pageNotFoundNode = item;
});
Expand All @@ -43,6 +43,8 @@
initNotFound = true;
vm.busy = !(initNotFound && initUserDetails);
});

vm.close = close;
}


Expand All @@ -69,26 +71,30 @@
}
}

$scope.hideSearch = function() {
function close() {
$scope.nav.hideDialog();
}

$scope.hideSearch = function () {
$scope.searchInfo.showSearch = false;
$scope.searchInfo.searchFromId = null;
$scope.searchInfo.searchFromName = null;
$scope.searchInfo.results = [];
};

// method to select a search result
$scope.selectResult = function(evt, result) {
$scope.selectResult = function (evt, result) {
result.selected = result.selected === true ? false : true;
nodeSelectHandler(evt, { event: evt, node: result });
};

//callback when there are search results
$scope.onSearchResults = function(results) {
$scope.onSearchResults = function (results) {
$scope.searchInfo.results = results;
$scope.searchInfo.showSearch = true;
};

$scope.setNotFoundPage = function() {
$scope.setNotFoundPage = function () {

vm.busy = true;
$scope.error = false;
Expand All @@ -101,11 +107,11 @@
if ($scope.target !== undefined && $scope.target !== null)
notFoundPageId = $scope.target.id;

pageNotFoundManagerResource.setNotFoundPage(parentId, notFoundPageId).then(function() {
pageNotFoundManagerResource.setNotFoundPage(parentId, notFoundPageId).then(function () {
$scope.error = false;
$scope.success = true;
vm.busy = false;
}, function(err) {
}, function (err) {
$scope.success = false;
$scope.error = err;
vm.busy = false;
Expand All @@ -120,7 +126,7 @@
}
}

$scope.onTreeInit = function() {
$scope.onTreeInit = function () {
$scope.dialogTreeApi.callbacks.treeLoaded(treeLoadedHandler);
$scope.dialogTreeApi.callbacks.treeNodeSelect(nodeSelectHandler);
$scope.dialogTreeApi.callbacks.treeNodeExpanded(nodeExpandedHandler);
Expand All @@ -130,6 +136,6 @@
}

angular.module("umbraco").controller("hc.pagenotfound.dialog.controller",
['$scope', 'hc.pageNotFoundManagerResource', 'notificationsService',
'userService', 'entityResource', 'iconHelper', PageNotFoundManagerDialog]);
['$scope', 'hc.pageNotFoundManagerResource', 'navigationService',
'userService', 'entityResource', 'iconHelper', PageNotFoundManagerDialog]);
})();
4 changes: 4 additions & 0 deletions src/HC.PageNotFoundManager/HC.PageNotFoundManager.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
<PropertyGroup>
<AssemblyVersion>1.0.0</AssemblyVersion>
<Version>1.0.0</Version>
<VersionSuffix>beta-004</VersionSuffix>
<InformationalVersion>1.0.0</InformationalVersion>
<TargetFramework>net5.0</TargetFramework>
<Authors>Nik Rimington</Authors>
Expand Down Expand Up @@ -37,4 +38,7 @@
<None Include="../../docs/img/logo.png" Pack="true" PackPath="\" />
<None Include="../../LICENSE" Pack="true" PackPath="" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Umbraco.Cms.Core" Version="9.0.0-rc002" />
</ItemGroup>
</Project>

0 comments on commit 82ae042

Please sign in to comment.