Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
91 changes: 91 additions & 0 deletions .github/README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,94 @@
# Umbraco.Community.SimpleTrees

[![Umbraco Marketplace](https://img.shields.io/badge/Umbraco-Marketplace-%233544B1?style=flat&logo=umbraco)](https://marketplace.umbraco.com/package/Umbraco.Community.SimpleTrees)
[![License](https://img.shields.io/github/license/jcdcdev/Umbraco.Community.SimpleTrees?color=8AB803&label=License&logo=github)](https://github.com/jcdcdev/Umbraco.Community.SimpleTrees?tab=MIT-1-ov-file)
[![NuGet Downloads](https://img.shields.io/nuget/dt/Umbraco.Community.SimpleTrees?color=cc9900&label=Downloads&logo=nuget)](https://www.nuget.org/packages/Umbraco.Community.SimpleTrees)
[![Project Website](https://img.shields.io/badge/Project%20Website-jcdc.dev-jcdcdev?style=flat&color=3c4834&logo=data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIxNiIgaGVpZ2h0PSIxNiIgZmlsbD0id2hpdGUiIGNsYXNzPSJiaSBiaS1wYy1kaXNwbGF5IiB2aWV3Qm94PSIwIDAgMTYgMTYiPgogIDxwYXRoIGQ9Ik04IDFhMSAxIDAgMCAxIDEtMWg2YTEgMSAwIDAgMSAxIDF2MTRhMSAxIDAgMCAxLTEgMUg5YTEgMSAwIDAgMS0xLTF6bTEgMTMuNWEuNS41IDAgMSAwIDEgMCAuNS41IDAgMCAwLTEgMG0yIDBhLjUuNSAwIDEgMCAxIDAgLjUuNSAwIDAgMC0xIDBNOS41IDFhLjUuNSAwIDAgMCAwIDFoNWEuNS41IDAgMCAwIDAtMXpNOSAzLjVhLjUuNSAwIDAgMCAuNS41aDVhLjUuNSAwIDAgMCAwLTFoLTVhLjUuNSAwIDAgMC0uNS41TTEuNSAyQTEuNSAxLjUgMCAwIDAgMCAzLjV2N0ExLjUgMS41IDAgMCAwIDEuNSAxMkg2djJoLS41YS41LjUgMCAwIDAgMCAxSDd2LTRIMS41YS41LjUgMCAwIDEtLjUtLjV2LTdhLjUuNSAwIDAgMSAuNS0uNUg3VjJ6Ii8+Cjwvc3ZnPg==)](https://jcdc.dev/umbraco-packages/simple-trees)


This packages aims to help developers quickly put together Umbraco Trees using C#.

## Features

- C# custom tree creation
- No javascript or umbraco-package.json files required
- Supports both Views & View Components
- Easy to define section permissions

## Quick Start

### Install Package

```csharp
dotnet add package Umbraco.Community.SimpleTrees
```

### Register Tree

By default, this will display in the content section.

```csharp title="ExampleTree.cs"
using Umbraco.Cms.Core.Models;
using Umbraco.Community.SimpleTrees.Models;

namespace Umbraco.Community.SimpleTrees.TestSite.Trees;

public class MyTree : SimpleTree
{
public override Task<PagedModel<ISimpleTreeItem>> GetTreeRootAsync(int skip, int take, bool foldersOnly)
{
var data = new List<ISimpleTreeItem>
{
CreateRootItem("James", Guid.NewGuid().ToString(), "icon-user"),
CreateRootItem("Tim", Guid.NewGuid().ToString(), "icon-user"),
};

return Task.FromResult(new PagedModel<ISimpleTreeItem>(data.Count, data));
}

public override Task<PagedModel<ISimpleTreeItem>> GetTreeChildrenAsync(string entityType, string parentUnique, int skip, int take, bool foldersOnly) => Task.FromResult(EmptyResult());

public override string Name => "My Tree";
}
```

### Create Views

- Your views **must** go in `/Views/Trees`
- You views **must** be the name of your tree entities
- For example: `MyTree.cs` => `/Views/Trees/MyItem.cshtml` & `/Views/Trees/MyRoot.cshtml`

```csharp title="Views/Trees/MyItem.cshtml"
@inherits Umbraco.Community.SimpleTrees.Web.SimpleTreeViewPage

<uui-box headline="This is a custom tree item">
<div>
<table>
<thead>
<tr>
<th>Entity Type</th>
<th>Unique</th>
</tr>
</thead>
<tbody>
<tr>
<td>@Model.EntityType</td>
<td>@Model.Unique</td>
</tr>
</table>
</div>
</uui-box>
```



## Contributing

Contributions to this package are most welcome! Please visit the [Contributing](https://github.com/jcdcdev/Umbraco.Community.SimpleTrees/contribute) page.

## Acknowledgements (Thanks)

- LottePitcher - [opinionated-package-starter](https://github.com/LottePitcher/opinionated-package-starter)



2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,6 @@ jobs:
project-path: src/Umbraco.Community.SimpleTrees/Umbraco.Community.SimpleTrees.csproj
npm-working-dir: src/Umbraco.Community.SimpleTrees.Client
npm-enabled: true
umbraco-version: 16
umbraco-version: 15
dotnet-version: "9"
npm-version: "22.x"
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
npm-working-dir: src/Umbraco.Community.SimpleTrees.Client
npm-enabled: true
npm-version: "22.x"
umbraco-version: 16
umbraco-version: 15
dotnet-version: "9"
- name: Release
uses: jcdcdev/jcdcdev.Umbraco.GitHub.Release@main
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/update-readme.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ jobs:
needs: get-refs
env:
DRY_RUN: ${{ github.event.inputs.dry-run }}
PROJECT_NAME: jcdcdev.Umbraco.RelationsManager
PROJECT_NAME: Umbraco.Community.SimpleTrees
README_FILEPATH: ./.github/README.md
NUGET_README_FILEPATH: ./docs/README_nuget.md
strategy:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/update-security-policy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ jobs:
needs: get-refs
env:
DRY_RUN: ${{ github.event.inputs.dry-run }}
PROJECT_NAME: jcdcdev.Umbraco.RelationsManager
PROJECT_NAME: Umbraco.Community.SimpleTrees
SECURITY_POLICY_FILEPATH: ./SECURITY.md
strategy:
max-parallel: 1
Expand Down
55 changes: 55 additions & 0 deletions SECURITY.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
# Security Policy

## Supported Versions

The following table outlines the versions of the project that are currently supported with security & feature updates:

> [!NOTE]
> Once a version starts its security phase, it will no longer receive feature updates. Only critical bug fixes and security updates will be provided.

| Package Version | Umbraco Version | Security Phase Start | End of Life |
| ---------------------------------------------------------------------------------- | --------------- | -------------------- | ----------- |
| [15.x](https://github.com/jcdcdev/Umbraco.Community.SimpleTrees/tree/v15) | 15 | 2025-08-14 | 2025-11-14 |
| [16.x](https://github.com/jcdcdev/Umbraco.Community.SimpleTrees/tree/v16) | 16 | 2026-03-12 | 2026-06-12 |


## Future Support

Project maintainers plan to support all STS (Short-Term Support) and LTS (Long-Term Support) versions of Umbraco. However, exact release dates cannot be guaranteed.

> [!NOTE]
> Visit [jcdc.dev/blog/umbraco-version-information](https://jcdc.dev/blog/umbraco-version-information) for more information on Umbraco versions.

## Reporting a Vulnerability

If you discover a vulnerability in this project, please follow one of these steps to report it:

- Create an [issue](https://github.com/jcdcdev/Umbraco.Community.SimpleTrees/security/advisories/new)
- Contact the project author privately at [jcdc.dev/contact](https://jcdc.dev/contact)

### Details

Include as much information as possible about the vulnerability, including:

- Steps to reproduce
- Potential impact
- Any suggested fixes

### Acknowledgment

You will receive an acknowledgment of your report as soon as possible.

> [!NOTE]
> Response times may vary depending on other commitments.

### Resolution

Once the vulnerability is confirmed, project maintainers will work to resolve it as quickly as possible.

You will be notified once the issue has been resolved or rejected.

> [!TIP]
> If the vulnerability is accepted, you will receive credit in the release notes.

Thank you for helping to keep this project secure!

90 changes: 90 additions & 0 deletions docs/README_nuget.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,94 @@
# Umbraco.Community.SimpleTrees

[![Documentation](https://img.shields.io/badge/Docs-Quickstart-394933?style=flat&logo=github)](https://github.com/jcdcdev/Umbraco.Community.SimpleTrees#quick-start)
[![Umbraco Marketplace](https://img.shields.io/badge/Umbraco-Marketplace-%233544B1?style=flat&logo=umbraco)](https://marketplace.umbraco.com/package/Umbraco.Community.SimpleTrees)
[![License](https://img.shields.io/github/license/jcdcdev/Umbraco.Community.SimpleTrees?color=8AB803&label=License&logo=github)](https://github.com/jcdcdev/Umbraco.Community.SimpleTrees?tab=MIT-1-ov-file)
[![NuGet Downloads](https://img.shields.io/nuget/dt/Umbraco.Community.SimpleTrees?color=cc9900&label=Downloads&logo=nuget)](https://www.nuget.org/packages/Umbraco.Community.SimpleTrees)
[![Project Website](https://img.shields.io/badge/Project%20Website-jcdc.dev-jcdcdev?style=flat&color=3c4834&logo=data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIxNiIgaGVpZ2h0PSIxNiIgZmlsbD0id2hpdGUiIGNsYXNzPSJiaSBiaS1wYy1kaXNwbGF5IiB2aWV3Qm94PSIwIDAgMTYgMTYiPgogIDxwYXRoIGQ9Ik04IDFhMSAxIDAgMCAxIDEtMWg2YTEgMSAwIDAgMSAxIDF2MTRhMSAxIDAgMCAxLTEgMUg5YTEgMSAwIDAgMS0xLTF6bTEgMTMuNWEuNS41IDAgMSAwIDEgMCAuNS41IDAgMCAwLTEgMG0yIDBhLjUuNSAwIDEgMCAxIDAgLjUuNSAwIDAgMC0xIDBNOS41IDFhLjUuNSAwIDAgMCAwIDFoNWEuNS41IDAgMCAwIDAtMXpNOSAzLjVhLjUuNSAwIDAgMCAuNS41aDVhLjUuNSAwIDAgMCAwLTFoLTVhLjUuNSAwIDAgMC0uNS41TTEuNSAyQTEuNSAxLjUgMCAwIDAgMCAzLjV2N0ExLjUgMS41IDAgMCAwIDEuNSAxMkg2djJoLS41YS41LjUgMCAwIDAgMCAxSDd2LTRIMS41YS41LjUgMCAwIDEtLjUtLjV2LTdhLjUuNSAwIDAgMSAuNS0uNUg3VjJ6Ii8+Cjwvc3ZnPg==)](https://jcdc.dev/umbraco-packages/simple-trees)


This packages aims to help developers quickly put together Umbraco Trees using C#.

## Features

- C# custom tree creation
- No javascript or umbraco-package.json files required
- Supports both Views & View Components
- Easy to define section permissions

## Quick Start

### Install Package

```csharp
dotnet add package Umbraco.Community.SimpleTrees
```

### Register Tree

By default, this will display in the content section.

```csharp title="ExampleTree.cs"
using Umbraco.Cms.Core.Models;
using Umbraco.Community.SimpleTrees.Models;

namespace Umbraco.Community.SimpleTrees.TestSite.Trees;

public class MyTree : SimpleTree
{
public override Task<PagedModel<ISimpleTreeItem>> GetTreeRootAsync(int skip, int take, bool foldersOnly)
{
var data = new List<ISimpleTreeItem>
{
CreateRootItem("James", Guid.NewGuid().ToString(), "icon-user"),
CreateRootItem("Tim", Guid.NewGuid().ToString(), "icon-user"),
};

return Task.FromResult(new PagedModel<ISimpleTreeItem>(data.Count, data));
}

public override Task<PagedModel<ISimpleTreeItem>> GetTreeChildrenAsync(string entityType, string parentUnique, int skip, int take, bool foldersOnly) => Task.FromResult(EmptyResult());

public override string Name => "My Tree";
}
```

### Create Views

- Your views **must** go in `/Views/Trees`
- You views **must** be the name of your tree entities
- For example: `MyTree.cs` => `/Views/Trees/MyItem.cshtml` & `/Views/Trees/MyRoot.cshtml`

```csharp title="Views/Trees/MyItem.cshtml"
@inherits Umbraco.Community.SimpleTrees.Web.SimpleTreeViewPage

<uui-box headline="This is a custom tree item">
<div>
<table>
<thead>
<tr>
<th>Entity Type</th>
<th>Unique</th>
</tr>
</thead>
<tbody>
<tr>
<td>@Model.EntityType</td>
<td>@Model.Unique</td>
</tr>
</table>
</div>
</uui-box>
```


## Contributing

Contributions to this package are most welcome! Please visit the [Contributing](https://github.com/jcdcdev/Umbraco.Community.SimpleTrees/contribute) page.

## Acknowledgements (Thanks)

- LottePitcher - [opinionated-package-starter](https://github.com/LottePitcher/opinionated-package-starter)



Binary file added docs/screenshots/custom-nuget-tree-item.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/screenshots/custom-tree-item-0.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/screenshots/custom-tree-item-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/screenshots/custom-tree-item-2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/screenshots/tree-not-found.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Loading