Our.Umbraco.SimpleTreeMenu 0.2.0

Typed Treemenu for Umbraco

There is a newer version of this package available.
See the version list below for details.
Install-Package Our.Umbraco.SimpleTreeMenu -Version 0.2.0
dotnet add package Our.Umbraco.SimpleTreeMenu --version 0.2.0
<PackageReference Include="Our.Umbraco.SimpleTreeMenu" Version="0.2.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Our.Umbraco.SimpleTreeMenu --version 0.2.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.

Our.Umbraco.SimpleTreeMenu

A simple treemenu propertyeditor that uses a doc-type (element) for menu items.

With a valueconverter that utilize the built in nestedcontent for type conversion of menu items.
Every item can be cast to an IPublishedElement for propertyaccess through Umbracos extension-methods.

It will work without the valueconverter, just remove the binary and use JObject instead of IEnumerable<ISimpleTreeItem>

Example:

@{

  var navigationModel = Model.Value<IEnumerable<ISimpleTreeItem>>("navigation", defaultValue: new List<ISimpleTreeItem>());
  
  @:<ul>

    foreach (var item in navigationModel)
    {

      var element = (IPublishedElement)item;
      var url = element.Value<IPublishedContent>("linkedContent")?.Url ?? element.Value<string>("linkedUrl") ?? "#";

      @:<li><a href="@url">@(element.Value<string>("title"))</a></li>

      if (item.Children.Any())
      {
        @:<ul>
          foreach (var child in item.Children)
          {
            var cElement = (IPublishedElement)child;
            @:<li>@(cElement.Value<string>("title"))</li>
          }
        @:</ul>
      }
    }

  @:</ul>
}

Our.Umbraco.SimpleTreeMenu

A simple treemenu propertyeditor that uses a doc-type (element) for menu items.

With a valueconverter that utilize the built in nestedcontent for type conversion of menu items.
Every item can be cast to an IPublishedElement for propertyaccess through Umbracos extension-methods.

It will work without the valueconverter, just remove the binary and use JObject instead of IEnumerable<ISimpleTreeItem>

Example:

@{

  var navigationModel = Model.Value<IEnumerable<ISimpleTreeItem>>("navigation", defaultValue: new List<ISimpleTreeItem>());
  
  @:<ul>

    foreach (var item in navigationModel)
    {

      var element = (IPublishedElement)item;
      var url = element.Value<IPublishedContent>("linkedContent")?.Url ?? element.Value<string>("linkedUrl") ?? "#";

      @:<li><a href="@url">@(element.Value<string>("title"))</a></li>

      if (item.Children.Any())
      {
        @:<ul>
          foreach (var child in item.Children)
          {
            var cElement = (IPublishedElement)child;
            @:<li>@(cElement.Value<string>("title"))</li>
          }
        @:</ul>
      }
    }

  @:</ul>
}

Release Notes

- Issue: Fixed issue with angularjs release mode.
         - Feature: Added clone/copy
         - Minor UI changes
         - Removed default datatype and default doctype from package

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version History

Version Downloads Last updated
1.1.0 168 11/19/2020
1.0.0 444 8/21/2020
0.2.2 711 4/29/2020
0.2.0 365 12/12/2019
0.1.3 151 12/4/2019
0.1.1 148 11/14/2019