1- # Umbraco.Community.SimpleTrees
2-
3- [ ![ Umbraco Marketplace] ( https://img.shields.io/badge/Umbraco-Marketplace-%233544B1?style=flat&logo=umbraco )] ( https://marketplace.umbraco.com/package/Umbraco.Community.SimpleTrees )
4- [ ![ 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 )
5- [ ![ 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 )
6- [ ![ 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 )
7-
8-
1+ # Umbraco.Community.SimpleTrees
2+
3+ [ ![ Umbraco Marketplace] ( https://img.shields.io/badge/Umbraco-Marketplace-%233544B1?style=flat&logo=umbraco )] ( https://marketplace.umbraco.com/package/Umbraco.Community.SimpleTrees )
4+ [ ![ 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 )
5+ [ ![ 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 )
6+ [ ![ 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 )
7+
8+
99This packages aims to help developers quickly put together Umbraco Trees using C#.
1010
1111## Features
1212
1313- C# custom tree creation
1414- No javascript or umbraco-package.json files required
1515- Supports both Views & View Components
16- - Easy to define section permissions
17-
18- ## Quick Start
19-
16+ - Easy to define section permissions
17+ - ✨ Custom Entity Actions!
18+
19+ > [ !IMPORTANT]
20+ > Version 15 will only receive security updates and no new features.
21+
22+ > Please review the [ security policy] ( https://github.com/jcdcdev/Umbraco.Community.SimpleTrees?tab=security-ov-file#supported-versions ) for more information.
23+
24+ ## Quick Start
25+
2026### Install Package
2127
2228``` csharp
@@ -29,7 +35,7 @@ By default, this will display in the content section.
2935
3036``` csharp title="ExampleTree.cs"
3137using Umbraco .Cms .Core .Models ;
32- using Umbraco .Community .SimpleTrees .Models ;
38+ using Umbraco .Community .SimpleTrees .Core . Models ;
3339
3440namespace Umbraco .Community .SimpleTrees .TestSite .Trees ;
3541
@@ -78,17 +84,101 @@ public class MyTree : SimpleTree
7884 < / table >
7985 < / div >
8086< / uui - box >
81- ```
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-
93-
87+ ```
88+
89+
90+ ## Extending
91+
92+ ### Entity Actions
93+
94+ It is possible to implement two Entity Actions
95+
96+ #### Url Actions
97+
98+ When clicked , the user will be taken to the specific URL .
99+
100+ ```csharp title = " NuGetPackageItemEntityUrlAction.cs"
101+ using Umbraco .Community .SimpleTrees .Core .Models ;
102+
103+ namespace Umbraco .Community .SimpleTrees .TestSite .Trees ;
104+
105+ public class NuGetPackageItemEntityUrlAction : SimpleEntityUrlAction
106+ {
107+ public override string Icon => " icon-link" ;
108+ public override string Name => " Go to Package" ;
109+ public override Type [] ForTreeItems => [typeof (NuGetPackageTree )];
110+ public override Type [] ForSimpleEntityTypes => [typeof (NuGetPackageVersionEntityType )];
111+
112+ public override Task <Uri > GetUrlAsync (string unique , string entityType )
113+ {
114+ var uri = new Uri (" https://www.nuget.org/packages/" + unique );
115+ return Task .FromResult (uri );
116+ }
117+ }
118+ ```
119+
120+ #### Execute Actions
121+
122+ When clicked, you custom logic will be executed. You can also return a helpful response to the user.
123+
124+ ``` csharp title="NuGetPackageItemEntityExecuteAction"
125+ using System .Net .Http .Headers ;
126+ using Umbraco .Community .SimpleTrees .Core .Models ;
127+ using Umbraco .Community .SimpleTrees .Web .Models ;
128+
129+ namespace Umbraco .Community .SimpleTrees .TestSite .Trees ;
130+
131+ public class NuGetPackageItemEntityExecuteAction : SimpleEntityExecuteAction
132+ {
133+ private readonly HttpClient _client ;
134+
135+ public NuGetPackageItemEntityExecuteAction (HttpClient client )
136+ {
137+ var url = " https://functions.marketplace.umbraco.com/api/" ;
138+ client .BaseAddress = new Uri (url );
139+ client .DefaultRequestHeaders .UserAgent .Add (new ProductInfoHeaderValue (" Umbraco.Community.SimpleTrees.TestSite" , " 1.0" ));
140+ _client = client ;
141+ }
142+
143+ public override string Icon => " icon-refresh" ;
144+ public override string Name => " Sync Package" ;
145+ public override Type [] ForTreeItems => [typeof (NuGetPackageTree )];
146+
147+ public override async Task <SimpleEntityActionExecuteResponse > ExecuteAsync (string unique , string entityType )
148+ {
149+ try
150+ {
151+ var split = unique .Split ('_' );
152+ var packageId = split [0 ];
153+ var model = new MarketplaceRequest
154+ {
155+ PackageId = packageId ,
156+ };
157+
158+ var result = await _client .PostAsJsonAsync (" InitiateSinglePackageSyncFunction" , model );
159+ if (! result .IsSuccessStatusCode )
160+ {
161+ return SimpleEntityActionExecuteResponse .Error (" Failed to initiate package update" , $" Status Code: {result .StatusCode }, Reason: {result .ReasonPhrase }" );
162+ }
163+
164+ var message = $" Package {packageId } update has been initiated. You can check the progress in the Umbraco Marketplace." ;
165+ return SimpleEntityActionExecuteResponse .Success (" Package update initiated successfully" , message );
166+ }
167+ catch (Exception ex )
168+ {
169+ return SimpleEntityActionExecuteResponse .Error (" An error occurred while initiating the package update" , ex .Message );
170+ }
171+ }
172+ }
173+ ```
174+
175+ ## Contributing
176+
177+ Contributions to this package are most welcome! Please visit the [ Contributing] ( https://github.com/jcdcdev/Umbraco.Community.SimpleTrees/contribute ) page.
178+
179+ ## Acknowledgements (Thanks)
180+
181+ - LottePitcher - [ opinionated-package-starter] ( https://github.com/LottePitcher/opinionated-package-starter )
182+
183+
94184
0 commit comments