6 votes

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 class="nav-link" href="@url">@(element.Value<string>("title"))</a></li>

        if (item.Children.Any())
        {
            @:<ul>
                foreach (var child in item.Children)
                {
                    var cElement = (IPublishedElement)child;
                    var cUrl = cElement.Value<IPublishedContent>("linkedContent")?.Url ?? cElement.Value<string>("linkedUrl") ?? "#";
                    @:<li><a class="nav-link" href="@cUrl">@(cElement.Value<string>("title"))</a></li>
                }
            @:</ul>
        }
    }

    @:</ul>
}
```

@:</ul>

 

Changes:

0.1.3

0.2

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

0.2.2

  • Validate doctype
  • Dropdown doctypepicker for datatype

1.0

  • Minor bugfixes
  • Feature: "Named template", auto generate node name based on properties.
    Defaults:  {{$id}}, {{$key}}, {{$type}}, {{$level}}
  • Property actions, copy and paste/insert trees

1.1

  • Permission fix #16 - @DarkSummon

2.0

  • New version for Umbraco 9 and Umbraco 8

3.0

  • New version for targeting V8, V9 and V10

Documentation

Source code

 Download package
version 4.0.2

NuGet install instructions for Umbraco 8.1.0-9+

Install-Package Our.Umbraco.SimpleTreeMenu

NuGet install instructions for Umbraco 9+

dotnet add package Our.Umbraco.SimpleTreeMenu

Package owner

Dennis Öhman

Dennis Öhman

Dennis has 177 karma points

Package Compatibility

This package is compatible with the following versions as reported by community members who have downloaded this package:
Untested or doesn't work on Umbraco Cloud
Version 8.18.x (untested)

You must login before you can report on package compatibility.

Previously reported to work on versions: 8.17.x, 8.16.x, 8.15.x, 8.14.x, 8.13.x, 8.12.x, 8.11.x, 8.10.x, 8.9.x, 8.8.x, 8.7.x, 8.6.x, 8.5.x, 8.4.x, 8.3.x, 8.2.x, 8.1.x

Package Information

  • Package owner: Dennis Öhman
  • Created: 10/11/2019
  • Current version 4.0.2
  • .NET version 4.7.2
  • License MIT
  • Downloads on Our: 1.8K
  • Downloads on NuGet: 31.1K
  • Total downloads : 32.9K