Skip to content

Commit f913c02

Browse files
committed
doc: Update NuGet README
1 parent 5cce6c0 commit f913c02

File tree

1 file changed

+90
-0
lines changed

1 file changed

+90
-0
lines changed

docs/README_nuget.md

Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,94 @@
11
# Umbraco.Community.SimpleTrees
22

3+
[![Documentation](https://img.shields.io/badge/Docs-Quickstart-394933?style=flat&logo=github)](https://github.com/jcdcdev/Umbraco.Community.SimpleTrees#quick-start)
4+
[![Umbraco Marketplace](https://img.shields.io/badge/Umbraco-Marketplace-%233544B1?style=flat&logo=umbraco)](https://marketplace.umbraco.com/package/Umbraco.Community.SimpleTrees)
5+
[![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)
6+
[![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)
7+
[![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)
8+
9+
10+
This packages aims to help developers quickly put together Umbraco Trees using C#.
11+
12+
## Features
13+
14+
- C# custom tree creation
15+
- No javascript or umbraco-package.json files required
16+
- Supports both Views & View Components
17+
- Easy to define section permissions
18+
19+
## Quick Start
20+
21+
### Install Package
22+
23+
```csharp
24+
dotnet add package Umbraco.Community.SimpleTrees
25+
```
26+
27+
### Register Tree
28+
29+
By default, this will display in the content section.
30+
31+
```csharp title="ExampleTree.cs"
32+
using Umbraco.Cms.Core.Models;
33+
using Umbraco.Community.SimpleTrees.Models;
34+
35+
namespace Umbraco.Community.SimpleTrees.TestSite.Trees;
36+
37+
public class MyTree : SimpleTree
38+
{
39+
public override Task<PagedModel<ISimpleTreeItem>> GetTreeRootAsync(int skip, int take, bool foldersOnly)
40+
{
41+
var data = new List<ISimpleTreeItem>
42+
{
43+
CreateRootItem("James", Guid.NewGuid().ToString(), "icon-user"),
44+
CreateRootItem("Tim", Guid.NewGuid().ToString(), "icon-user"),
45+
};
46+
47+
return Task.FromResult(new PagedModel<ISimpleTreeItem>(data.Count, data));
48+
}
49+
50+
public override Task<PagedModel<ISimpleTreeItem>> GetTreeChildrenAsync(string entityType, string parentUnique, int skip, int take, bool foldersOnly) => Task.FromResult(EmptyResult());
51+
52+
public override string Name => "My Tree";
53+
}
54+
```
55+
56+
### Create Views
57+
58+
- Your views **must** go in `/Views/Trees`
59+
- You views **must** be the name of your tree entities
60+
- For example: `MyTree.cs` => `/Views/Trees/MyItem.cshtml` & `/Views/Trees/MyRoot.cshtml`
61+
62+
```csharp title="Views/Trees/MyItem.cshtml"
63+
@inherits Umbraco.Community.SimpleTrees.Web.SimpleTreeViewPage
64+
65+
<uui-box headline="This is a custom tree item">
66+
<div>
67+
<table>
68+
<thead>
69+
<tr>
70+
<th>Entity Type</th>
71+
<th>Unique</th>
72+
</tr>
73+
</thead>
74+
<tbody>
75+
<tr>
76+
<td>@Model.EntityType</td>
77+
<td>@Model.Unique</td>
78+
</tr>
79+
</table>
80+
</div>
81+
</uui-box>
82+
```
83+
84+
85+
## Contributing
86+
87+
Contributions to this package are most welcome! Please visit the [Contributing](https://github.com/jcdcdev/Umbraco.Community.SimpleTrees/contribute) page.
88+
89+
## Acknowledgements (Thanks)
90+
91+
- LottePitcher - [opinionated-package-starter](https://github.com/LottePitcher/opinionated-package-starter)
92+
393

494

0 commit comments

Comments
 (0)