diff --git a/.github/workflows/dotnet-build-release.yml b/.github/workflows/dotnet-build-release.yml index ae1b582..3db75cc 100644 --- a/.github/workflows/dotnet-build-release.yml +++ b/.github/workflows/dotnet-build-release.yml @@ -91,7 +91,7 @@ jobs: with: name: ${{steps.gitversion.outputs.fullSemVer}} tag_name: ${{steps.gitversion.outputs.fullSemVer}} - prerelease: true + prerelease: false generate_release_notes: true files: | ./build.out/Our.Umbraco.UmbNav.Web.${{steps.gitversion.outputs.nuGetVersionV2}}.nupkg diff --git a/TestSiteV13/uSync/v9/DataTypes/HomeUmbNavUmbNav.config b/TestSiteV13/uSync/v9/DataTypes/HomeUmbNavUmbNav.config index e0e6c1d..48f2f09 100644 --- a/TestSiteV13/uSync/v9/DataTypes/HomeUmbNavUmbNav.config +++ b/TestSiteV13/uSync/v9/DataTypes/HomeUmbNavUmbNav.config @@ -11,6 +11,7 @@ "AllowDisplayAsLabel": true, "AllowImageIcon": false, "AllowLabels": true, + "AllowMenuItemDescriptions": false, "ExpandOnHover": true, "ExpandOnHoverTimeout": 500, "HideIncludeChildren": false, diff --git a/src/UmbNav.Api/UmbNav.Api.csproj b/src/UmbNav.Api/UmbNav.Api.csproj index 92704f3..ea311bb 100644 --- a/src/UmbNav.Api/UmbNav.Api.csproj +++ b/src/UmbNav.Api/UmbNav.Api.csproj @@ -16,7 +16,7 @@ https://github.com/AaronSadlerUK/Our.Umbraco.UmbNav Aaron Sadler UmbHost Limited - 2022 UmbHost Limited + $([System.DateTime]::Now.ToString(`yyyy`)) UmbHost Limited MIT true 2.0.2 diff --git a/src/UmbNav.Core/Interfaces/IUmbNavMenuBuilderService.cs b/src/UmbNav.Core/Interfaces/IUmbNavMenuBuilderService.cs index e9b4252..faf8648 100644 --- a/src/UmbNav.Core/Interfaces/IUmbNavMenuBuilderService.cs +++ b/src/UmbNav.Core/Interfaces/IUmbNavMenuBuilderService.cs @@ -6,6 +6,6 @@ namespace UmbNav.Core.Interfaces public interface IUmbNavMenuBuilderService { IEnumerable BuildMenu(IEnumerable items, int level = 0, bool removeNaviHideItems = false, - bool removeNoopener = false, bool removeNoreferrer = false, bool removeIncludeChildNodes = false); + bool removeNoopener = false, bool removeNoreferrer = false, bool removeIncludeChildNodes = false, bool allowMenuItemDescriptions = false); } } diff --git a/src/UmbNav.Core/Models/UmbNavItem.cs b/src/UmbNav.Core/Models/UmbNavItem.cs index ab0aec0..5c4e7f3 100644 --- a/src/UmbNav.Core/Models/UmbNavItem.cs +++ b/src/UmbNav.Core/Models/UmbNavItem.cs @@ -21,6 +21,9 @@ public class UmbNavItem [JsonProperty("title")] public string Title { get; set; } + [JsonProperty("menuitemdescription")] + public string Description { get; set; } + [JsonProperty("target")] public string Target { get; set; } @@ -36,6 +39,9 @@ public class UmbNavItem [JsonProperty("children")] public IEnumerable Children { get; set; } + [JsonIgnore] + public UmbNavItem Parent { get; set; } + [JsonIgnore] public IPublishedContent Content { get; set; } diff --git a/src/UmbNav.Core/PropertyEditors/UmbNavConfiguration.cs b/src/UmbNav.Core/PropertyEditors/UmbNavConfiguration.cs index a48af57..815deeb 100644 --- a/src/UmbNav.Core/PropertyEditors/UmbNavConfiguration.cs +++ b/src/UmbNav.Core/PropertyEditors/UmbNavConfiguration.cs @@ -46,5 +46,9 @@ public class UmbNavConfiguration [ConfigurationField("showTopAddButton", "Show \"Add Item\" Button", "boolean", Description = "Show the \"Add Item\" button above the nav items in the editor")] public bool ShowTopAddButton { get; set; } = true; + + [ConfigurationField("allowMenuItemDescriptions", "Allow Menu Item Descriptions", "boolean", + Description = "Add a text field to the menu item to contain a description")] + public bool AllowMenuItemDescriptions { get; set; } = false; } } diff --git a/src/UmbNav.Core/Services/UmbNavMenuBuilderService.cs b/src/UmbNav.Core/Services/UmbNavMenuBuilderService.cs index 2af4f59..20def34 100644 --- a/src/UmbNav.Core/Services/UmbNavMenuBuilderService.cs +++ b/src/UmbNav.Core/Services/UmbNavMenuBuilderService.cs @@ -28,7 +28,7 @@ public UmbNavMenuBuilderService(IPublishedSnapshotAccessor publishedSnapshotAcce } public IEnumerable BuildMenu(IEnumerable items, int level = 0, bool removeNaviHideItems = false, - bool removeNoopener = false, bool removeNoreferrer = false, bool removeIncludeChildNodes = false) + bool removeNoopener = false, bool removeNoreferrer = false, bool removeIncludeChildNodes = false, bool allowMenuItemDescriptions = false) { var umbNavItems = items.ToList(); var removeItems = new List(); @@ -70,6 +70,11 @@ public IEnumerable BuildMenu(IEnumerable items, int leve item.Title = item.Name; } + if (!allowMenuItemDescriptions) + { + item.Description = null; + } + //if (!item.DisplayAsLabel) //{ // continue; @@ -79,6 +84,11 @@ public IEnumerable BuildMenu(IEnumerable items, int leve var children = new List(); if (item.Children != null && item.Children.Any()) { + foreach (var child in item.Children) + { + child.Parent = item; + } + children = item.Children.ToList(); } diff --git a/src/UmbNav.Core/UmbNav.Core.csproj b/src/UmbNav.Core/UmbNav.Core.csproj index 0f552f8..09b286c 100644 --- a/src/UmbNav.Core/UmbNav.Core.csproj +++ b/src/UmbNav.Core/UmbNav.Core.csproj @@ -16,7 +16,7 @@ https://github.com/AaronSadlerUK/Our.Umbraco.UmbNav Aaron Sadler UmbHost Limited - 2023 UmbHost Limited + $([System.DateTime]::Now.ToString(`yyyy`)) UmbHost Limited MIT true 2.0.3 diff --git a/src/UmbNav.Core/ValueConverters/UmbNavValueConverter.cs b/src/UmbNav.Core/ValueConverters/UmbNavValueConverter.cs index 7e0320b..8f372c2 100644 --- a/src/UmbNav.Core/ValueConverters/UmbNavValueConverter.cs +++ b/src/UmbNav.Core/ValueConverters/UmbNavValueConverter.cs @@ -20,6 +20,7 @@ public class UmbNavValueConverter : PropertyValueConverterBase private bool _removeNoopener; private bool _removeNoreferrer; private bool _removeIncludeChildNodes; + private bool _allowMenuItemDescriptions; public UmbNavValueConverter(ILogger logger, IUmbNavMenuBuilderService umbNavMenuBuilderService) { @@ -49,13 +50,14 @@ public override object ConvertIntermediateToObject(IPublishedElement owner, IPub _removeNoopener = configuration.HideNoopener; _removeNoreferrer = configuration.HideNoreferrer; _removeIncludeChildNodes = configuration.HideIncludeChildren; + _allowMenuItemDescriptions = configuration.AllowMenuItemDescriptions; } try { var items = JsonConvert.DeserializeObject>(inter.ToString()); - return _umbNavMenuBuilderService.BuildMenu(items, 0, _removeNaviHideItems, _removeNoopener, _removeNoreferrer, _removeIncludeChildNodes); + return _umbNavMenuBuilderService.BuildMenu(items, 0, _removeNaviHideItems, _removeNoopener, _removeNoreferrer, _removeIncludeChildNodes, _allowMenuItemDescriptions); } catch (Exception ex) { diff --git a/src/UmbNav.Web/UmbNav.Web.csproj b/src/UmbNav.Web/UmbNav.Web.csproj index 684a501..165ecc0 100644 --- a/src/UmbNav.Web/UmbNav.Web.csproj +++ b/src/UmbNav.Web/UmbNav.Web.csproj @@ -16,7 +16,7 @@ https://github.com/AaronSadlerUK/Our.Umbraco.UmbNav Aaron Sadler UmbHost Limited - 2023 UmbHost Limited + $([System.DateTime]::Now.ToString(`yyyy`)) UmbHost Limited MIT true 2.0.8 diff --git a/src/UmbNav.Web/wwwroot/js/umbnav.controller.js b/src/UmbNav.Web/wwwroot/js/umbnav.controller.js index 96bd420..233ccde 100644 --- a/src/UmbNav.Web/wwwroot/js/umbnav.controller.js +++ b/src/UmbNav.Web/wwwroot/js/umbnav.controller.js @@ -118,6 +118,7 @@ hideIncludeChildren: dialogOptions.config.hideIncludeChildren, allowLabels: dialogOptions.config.allowLabels, allowDisplayAsLabel: dialogOptions.config.allowDisplayAsLabel, + allowMenuItemDescriptions: dialogOptions.config.allowMenuItemDescriptions, currentTarget: item, submit: function (model) { @@ -188,6 +189,7 @@ description: url, collapsed: data.collapsed, title: data.title, + menuitemdescription: data.menuitemdescription, target: data.target, noopener: data.noopener, noreferrer: data.noreferrer, diff --git a/src/UmbNav.Web/wwwroot/js/umbnav.settings.controller.js b/src/UmbNav.Web/wwwroot/js/umbnav.settings.controller.js index 42a0301..6e225cf 100644 --- a/src/UmbNav.Web/wwwroot/js/umbnav.settings.controller.js +++ b/src/UmbNav.Web/wwwroot/js/umbnav.settings.controller.js @@ -82,6 +82,7 @@ $scope.showCustomClasses = $scope.model.allowCustomClasses === true; $scope.showImageIcon = $scope.model.allowImageIcon === true; $scope.allowLabels = $scope.model.allowLabels === true; + $scope.allowMenuItemDescriptions = $scope.model.allowMenuItemDescriptions === true; $scope.showAdvancedBlock = showAdvanced(); if (!$scope.allowLabels) { $scope.model.target.itemType = 'link'; diff --git a/src/UmbNav.Web/wwwroot/lang/en-us.xml b/src/UmbNav.Web/wwwroot/lang/en-us.xml index 1288cda..34b55b9 100644 --- a/src/UmbNav.Web/wwwroot/lang/en-us.xml +++ b/src/UmbNav.Web/wwwroot/lang/en-us.xml @@ -25,6 +25,8 @@ Label Menu Item Title + Description + Enter a description... Menu Item Type Select menu item type Display as label diff --git a/src/UmbNav.Web/wwwroot/views/settings.html b/src/UmbNav.Web/wwwroot/views/settings.html index b50feea..94d5596 100644 --- a/src/UmbNav.Web/wwwroot/views/settings.html +++ b/src/UmbNav.Web/wwwroot/views/settings.html @@ -66,7 +66,12 @@ ng-model="model.target.title" ng-required="!model.target.name" /> - + + + ng-model="model.target.title" ng-required="!model.target.name" /> + + + + Show Description: {{allowMenuItemDescriptions}}