Skip to content

Commit

Permalink
Merge pull request #412 from leekelleher/dev/v5.x
Browse files Browse the repository at this point in the history
Preparing v5.0.2 release
  • Loading branch information
leekelleher authored Aug 19, 2024
2 parents 7eeae46 + 1b7d99f commit 08bc56b
Show file tree
Hide file tree
Showing 7 changed files with 116 additions and 7 deletions.
5 changes: 4 additions & 1 deletion .github/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,10 @@

> contentment /kənˈtɛntm(ə)nt/ - a state of happiness and satisfaction
[![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)
[![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)

> [!IMPORTANT]
> 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)!
### What is it?

Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
5.0.1
5.0.2
82 changes: 81 additions & 1 deletion docs/editors/data-picker.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,87 @@ This interface contains two methods;

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

> `// TODO: Add a code snippet example of a custom data source.`
```csharp
using Umbraco.Cms.Core.Models;
using Umbraco.Cms.Core.PropertyEditors;
using Umbraco.Community.Contentment.DataEditors;

namespace CodeExample;

public class EventDataSource : IDataPickerSource
{
private readonly IEventService _eventService;

public EventDataSource(IEventService eventService)
{
_eventService = eventService;
}

public string Name => "Events";
public string Description => "List of events";
public string Icon => "icon-movie-alt";
public Dictionary<string, object>? DefaultValues => default;
public IEnumerable<ConfigurationField>? Fields => default;
public string Group => "Custom datasources";
public OverlaySize OverlaySize => OverlaySize.Small;

public async Task<IEnumerable<DataListItem>> GetItemsAsync(
Dictionary<string, object> config,
IEnumerable<string> values
)
{
var items = new List<DataListItem>();

var events = (await _eventService.GetEventsAsync()).ToList();

if (events.Count == 0)
{
return items;
}

foreach (var eventItem in events)
{
items.Add(new DataListItem { Name = eventItem.Name, Value = eventItem.Id.ToString() });
}

return items.OrderBy(x => x.Name);
}

public async Task<PagedResult<DataListItem>> SearchAsync(
Dictionary<string, object> config,
int pageNumber = 1,
int pageSize = 12,
string query = ""
)
{
var items = new List<DataListItem>();

var events = await _eventService.SearchEventsAsync(query, null, null, null, null);

if (!events.Events.Any())
{
return new PagedResult<DataListItem>(0, pageNumber, pageSize) { Items = items };
}

foreach (var eventItem in events.Events)
{
items.Add(
new DataListItem
{
Name = eventItem.Name,
Value = eventItem.Id.ToString(),
Icon = "icon-movie-alt"
}
);
}

return new PagedResult<DataListItem>(events.EventCount, pageNumber, pageSize)
{
Items = items
};
}
}
```


##### Accessing contextual content
Expand Down
5 changes: 4 additions & 1 deletion src/Umbraco.Cms.13.x/DataSources/RenderPosition.cs
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
using Umbraco.Community.Contentment.DataEditors;
using Umbraco.Community.Contentment.DataEditors;

namespace Umbraco.Cms.Web.Common.PublishedModels
{
public enum RenderPosition
{
[DataListItem(Name = "Html", Description = "The root &lt;html&gt; tag", Disabled = true)]
Html = 3,

[DataListItem(Name = "Head", Description = "Inside the &lt;head&gt; tags")]
Head = 2,

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,13 @@ public DataListItemAttribute()

public string? Description { get; set; }

public bool? Disabled { get; set; }
public bool Disabled { get; set; } = false;

public string? Group { get; set; }

public string? Icon { get; set; }

public bool? Ignore { get; set; }
public bool Ignore { get; set; } = false;

public string? Name { get; set; }

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
<Product>Umbraco.Community.Contentment</Product>
<Title>Contentment for Umbraco</Title>
<Description>Contentment, a collection of components for Umbraco.</Description>
<Version>5.0.1</Version>
<Version>5.0.2</Version>
<Authors>Lee Kelleher</Authors>
<Company>Lee Kelleher</Company>
<Copyright>$([System.DateTime]::Now.Year) © $(Company)</Copyright>
Expand Down
23 changes: 23 additions & 0 deletions umbraco-marketplace.json
Original file line number Diff line number Diff line change
Expand Up @@ -75,5 +75,28 @@
"text input"
],
"Title": "Contentment",
"VersionDependencyMode": "Default",
"VersionSpecificPackageIds": [
{
"UmbracoMajorVersion": 8,
"PackageId": "Our.Umbraco.Community.Contentment"
},
{
"UmbracoMajorVersion": 9,
"PackageId": "Our.Umbraco.Community.Contentment"
},
{
"UmbracoMajorVersion": 10,
"PackageId": "Our.Umbraco.Community.Contentment"
},
{
"UmbracoMajorVersion": 11,
"PackageId": "Our.Umbraco.Community.Contentment"
},
{
"UmbracoMajorVersion": 12,
"PackageId": "Our.Umbraco.Community.Contentment"
}
],
"VideoUrl": "https://www.youtube.com/embed/alhbwyQkU1E"
}

0 comments on commit 08bc56b

Please sign in to comment.