Skip to content

Commit 08bc56b

Browse files
authored
Merge pull request #412 from leekelleher/dev/v5.x
Preparing v5.0.2 release
2 parents 7eeae46 + 1b7d99f commit 08bc56b

File tree

7 files changed

+116
-7
lines changed

7 files changed

+116
-7
lines changed

.github/README.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,10 @@
44

55
> contentment /kənˈtɛntm(ə)nt/ - a state of happiness and satisfaction
66
7-
[![Mozilla Public License](https://img.shields.io/badge/MPL--2.0-orange?label=license)](https://opensource.org/licenses/MPL-2) [![Latest version](https://img.shields.io/nuget/v/Umbraco.Community.Contentment?label=version)](https://marketplace.umbraco.com/package/umbraco.community.contentment) [![NuGet download count](https://img.shields.io/nuget/dt/Our.Umbraco.Community.Contentment.Core?label=downloads)](https://www.nuget.org/packages/Umbraco.Community.Contentment)
7+
[![Mozilla Public License](https://img.shields.io/badge/MPL--2.0-orange?label=license)](https://opensource.org/licenses/MPL-2) [![Latest version](https://img.shields.io/nuget/v/Umbraco.Community.Contentment?label=version)](https://marketplace.umbraco.com/package/umbraco.community.contentment) [![NuGet download count](https://img.shields.io/nuget/dt/Umbraco.Community.Contentment?label=downloads)](https://www.nuget.org/packages/Umbraco.Community.Contentment)
8+
9+
> [!IMPORTANT]
10+
> If you are looking for **Contentment for Umbraco 14** (Bellissima, the new backoffice), [please see the latest progress updates](https://github.com/leekelleher/umbraco-contentment/discussions/357)!
811
912
### What is it?
1013

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
5.0.1
1+
5.0.2

docs/editors/data-picker.md

Lines changed: 81 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,87 @@ This interface contains two methods;
6767

6868
The `DataListItem` model is made up of four `string` properties: `Name`, `Value`, `Description` _(optional)_ and `Icon` _(optional)_.
6969

70-
> `// TODO: Add a code snippet example of a custom data source.`
70+
```csharp
71+
using Umbraco.Cms.Core.Models;
72+
using Umbraco.Cms.Core.PropertyEditors;
73+
using Umbraco.Community.Contentment.DataEditors;
74+
75+
namespace CodeExample;
76+
77+
public class EventDataSource : IDataPickerSource
78+
{
79+
private readonly IEventService _eventService;
80+
81+
public EventDataSource(IEventService eventService)
82+
{
83+
_eventService = eventService;
84+
}
85+
86+
public string Name => "Events";
87+
public string Description => "List of events";
88+
public string Icon => "icon-movie-alt";
89+
public Dictionary<string, object>? DefaultValues => default;
90+
public IEnumerable<ConfigurationField>? Fields => default;
91+
public string Group => "Custom datasources";
92+
public OverlaySize OverlaySize => OverlaySize.Small;
93+
94+
public async Task<IEnumerable<DataListItem>> GetItemsAsync(
95+
Dictionary<string, object> config,
96+
IEnumerable<string> values
97+
)
98+
{
99+
var items = new List<DataListItem>();
100+
101+
var events = (await _eventService.GetEventsAsync()).ToList();
102+
103+
if (events.Count == 0)
104+
{
105+
return items;
106+
}
107+
108+
foreach (var eventItem in events)
109+
{
110+
items.Add(new DataListItem { Name = eventItem.Name, Value = eventItem.Id.ToString() });
111+
}
112+
113+
return items.OrderBy(x => x.Name);
114+
}
115+
116+
public async Task<PagedResult<DataListItem>> SearchAsync(
117+
Dictionary<string, object> config,
118+
int pageNumber = 1,
119+
int pageSize = 12,
120+
string query = ""
121+
)
122+
{
123+
var items = new List<DataListItem>();
124+
125+
var events = await _eventService.SearchEventsAsync(query, null, null, null, null);
126+
127+
if (!events.Events.Any())
128+
{
129+
return new PagedResult<DataListItem>(0, pageNumber, pageSize) { Items = items };
130+
}
131+
132+
foreach (var eventItem in events.Events)
133+
{
134+
items.Add(
135+
new DataListItem
136+
{
137+
Name = eventItem.Name,
138+
Value = eventItem.Id.ToString(),
139+
Icon = "icon-movie-alt"
140+
}
141+
);
142+
}
143+
144+
return new PagedResult<DataListItem>(events.EventCount, pageNumber, pageSize)
145+
{
146+
Items = items
147+
};
148+
}
149+
}
150+
```
71151

72152

73153
##### Accessing contextual content

src/Umbraco.Cms.13.x/DataSources/RenderPosition.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,12 @@
1-
using Umbraco.Community.Contentment.DataEditors;
1+
using Umbraco.Community.Contentment.DataEditors;
22

33
namespace Umbraco.Cms.Web.Common.PublishedModels
44
{
55
public enum RenderPosition
66
{
7+
[DataListItem(Name = "Html", Description = "The root &lt;html&gt; tag", Disabled = true)]
8+
Html = 3,
9+
710
[DataListItem(Name = "Head", Description = "Inside the &lt;head&gt; tags")]
811
Head = 2,
912

src/Umbraco.Community.Contentment/DataEditors/DataList/DataListItemAttribute.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,13 @@ public DataListItemAttribute()
1515

1616
public string? Description { get; set; }
1717

18-
public bool? Disabled { get; set; }
18+
public bool Disabled { get; set; } = false;
1919

2020
public string? Group { get; set; }
2121

2222
public string? Icon { get; set; }
2323

24-
public bool? Ignore { get; set; }
24+
public bool Ignore { get; set; } = false;
2525

2626
public string? Name { get; set; }
2727

src/Umbraco.Community.Contentment/Umbraco.Community.Contentment.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
<Product>Umbraco.Community.Contentment</Product>
1515
<Title>Contentment for Umbraco</Title>
1616
<Description>Contentment, a collection of components for Umbraco.</Description>
17-
<Version>5.0.1</Version>
17+
<Version>5.0.2</Version>
1818
<Authors>Lee Kelleher</Authors>
1919
<Company>Lee Kelleher</Company>
2020
<Copyright>$([System.DateTime]::Now.Year) © $(Company)</Copyright>

umbraco-marketplace.json

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,5 +75,28 @@
7575
"text input"
7676
],
7777
"Title": "Contentment",
78+
"VersionDependencyMode": "Default",
79+
"VersionSpecificPackageIds": [
80+
{
81+
"UmbracoMajorVersion": 8,
82+
"PackageId": "Our.Umbraco.Community.Contentment"
83+
},
84+
{
85+
"UmbracoMajorVersion": 9,
86+
"PackageId": "Our.Umbraco.Community.Contentment"
87+
},
88+
{
89+
"UmbracoMajorVersion": 10,
90+
"PackageId": "Our.Umbraco.Community.Contentment"
91+
},
92+
{
93+
"UmbracoMajorVersion": 11,
94+
"PackageId": "Our.Umbraco.Community.Contentment"
95+
},
96+
{
97+
"UmbracoMajorVersion": 12,
98+
"PackageId": "Our.Umbraco.Community.Contentment"
99+
}
100+
],
78101
"VideoUrl": "https://www.youtube.com/embed/alhbwyQkU1E"
79102
}

0 commit comments

Comments
 (0)