Skip to content

Commit 83ba77e

Browse files
authored
Merge pull request #8 from Relewise/feat/umbraco-v10
feat: Umbraco V10 sample site
2 parents 0a4b63d + 4f22da1 commit 83ba77e

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+4924
-213
lines changed

.gitignore

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -350,4 +350,13 @@ MigrationBackup/
350350
.ionide/
351351

352352
appsettings.local.json
353-
local.settings.json
353+
local.settings.json
354+
355+
356+
**samples/UmbracoV10/wwwroot/css/**
357+
**samples/UmbracoV10/wwwroot/js/**
358+
**samples/UmbracoV10/wwwroot/vendor/**
359+
**samples/UmbracoV10/wwwroot/fonts/**
360+
**samples/UmbracoV10/wwwroot/images/**
361+
**samples/UmbracoV10/Views/**
362+
**samples/UmbracoV10/App_Plugins/**

Relewise.Integrations.Umbraco.sln

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,10 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Git", "Git", "{828EE997-758
1515
README.md = README.md
1616
EndProjectSection
1717
EndProject
18+
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Relewise.UmbracoV10", "samples\UmbracoV10\Relewise.UmbracoV10.csproj", "{3CEA229E-6690-4248-B6B0-1C3054D142FD}"
19+
EndProject
20+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Relewise.Umbraco.Application", "Relewise.Umbraco.Application\Relewise.Umbraco.Application.csproj", "{B9B5F0C9-3E2A-44BF-895F-0CC9963B8839}"
21+
EndProject
1822
Global
1923
GlobalSection(SolutionConfigurationPlatforms) = preSolution
2024
Debug|Any CPU = Debug|Any CPU
@@ -29,12 +33,22 @@ Global
2933
{53D4C642-13D2-4F61-A941-2CA19526315A}.Debug|Any CPU.Build.0 = Debug|Any CPU
3034
{53D4C642-13D2-4F61-A941-2CA19526315A}.Release|Any CPU.ActiveCfg = Release|Any CPU
3135
{53D4C642-13D2-4F61-A941-2CA19526315A}.Release|Any CPU.Build.0 = Release|Any CPU
36+
{3CEA229E-6690-4248-B6B0-1C3054D142FD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
37+
{3CEA229E-6690-4248-B6B0-1C3054D142FD}.Debug|Any CPU.Build.0 = Debug|Any CPU
38+
{3CEA229E-6690-4248-B6B0-1C3054D142FD}.Release|Any CPU.ActiveCfg = Release|Any CPU
39+
{3CEA229E-6690-4248-B6B0-1C3054D142FD}.Release|Any CPU.Build.0 = Release|Any CPU
40+
{B9B5F0C9-3E2A-44BF-895F-0CC9963B8839}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
41+
{B9B5F0C9-3E2A-44BF-895F-0CC9963B8839}.Debug|Any CPU.Build.0 = Debug|Any CPU
42+
{B9B5F0C9-3E2A-44BF-895F-0CC9963B8839}.Release|Any CPU.ActiveCfg = Release|Any CPU
43+
{B9B5F0C9-3E2A-44BF-895F-0CC9963B8839}.Release|Any CPU.Build.0 = Release|Any CPU
3244
EndGlobalSection
3345
GlobalSection(SolutionProperties) = preSolution
3446
HideSolutionNode = FALSE
3547
EndGlobalSection
3648
GlobalSection(NestedProjects) = preSolution
3749
{53D4C642-13D2-4F61-A941-2CA19526315A} = {41BF626B-F972-4C22-93B6-44AA3F463D7D}
50+
{3CEA229E-6690-4248-B6B0-1C3054D142FD} = {41BF626B-F972-4C22-93B6-44AA3F463D7D}
51+
{B9B5F0C9-3E2A-44BF-895F-0CC9963B8839} = {41BF626B-F972-4C22-93B6-44AA3F463D7D}
3852
EndGlobalSection
3953
GlobalSection(ExtensibilityGlobals) = postSolution
4054
SolutionGuid = {2F867AD8-FFBD-46E8-A4F6-6F7367A71DD5}

samples/UmbracoV9/Application/Api/ContentApi.cs renamed to Relewise.Umbraco.Application/Api/ContentApi.cs

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,4 @@
1-
using System;
2-
using System.Collections.Generic;
3-
using System.Linq;
4-
using System.Text.Json;
5-
using System.Threading;
6-
using System.Threading.Tasks;
1+
using System.Text.Json;
72
using Microsoft.AspNetCore.Builder;
83
using Microsoft.AspNetCore.Http;
94
using Microsoft.AspNetCore.Routing;
@@ -21,7 +16,7 @@
2116
using Relewise.Client.Search;
2217
using Relewise.Integrations.Umbraco;
2318

24-
namespace Relewise.UmbracoV9.Application.Api;
19+
namespace Relewise.Umbraco.Application.Api;
2520

2621
public static class ContentApi
2722
{
@@ -47,7 +42,7 @@ private static async Task Search(HttpContext context)
4742
Currency.Undefined,
4843
user,
4944
"Search Overlay",
50-
context.Request.Query["q"].First(),
45+
Enumerable.First<string>(context.Request.Query["q"]),
5146
skip: 0,
5247
take: 10)
5348
{
@@ -71,7 +66,7 @@ private static async Task Predict(HttpContext context)
7166
Currency.Undefined,
7267
user,
7368
"Search Overlay",
74-
context.Request.Query["q"].First(),
69+
Enumerable.First<string>(context.Request.Query["q"]),
7570
take: 10)
7671
{
7772
Settings = new SearchTermPredictionSettings

samples/UmbracoV9/Application/Api/NewsletterApi.cs renamed to Relewise.Umbraco.Application/Api/NewsletterApi.cs

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,12 @@
1-
using System.Linq;
2-
using System.Threading.Tasks;
3-
using Microsoft.AspNetCore.Builder;
1+
using Microsoft.AspNetCore.Builder;
42
using Microsoft.AspNetCore.Http;
53
using Microsoft.AspNetCore.Routing;
64
using Microsoft.Extensions.DependencyInjection;
75
using Relewise.Client;
86
using Relewise.Client.DataTypes;
97
using Relewise.Integrations.Umbraco;
108

11-
namespace Relewise.UmbracoV9.Application.Api;
9+
namespace Relewise.Umbraco.Application.Api;
1210

1311
public static class NewsletterApi
1412
{
@@ -25,7 +23,7 @@ private static async Task Subscribe(HttpContext context)
2523
IRelewiseUserLocator userLocator = context.RequestServices.GetRequiredService<IRelewiseUserLocator>();
2624
User user = await userLocator.GetUser();
2725

28-
user.Email = context.Request.Query["emailAddress"].First();
26+
user.Email = Enumerable.First<string>(context.Request.Query["emailAddress"]);
2927

3028
await tracker.TrackAsync(new UserUpdate(user), context.RequestAborted);
3129
}
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
using Relewise.Client.DataTypes;
2+
using Relewise.Integrations.Umbraco;
3+
using Relewise.Integrations.Umbraco.Infrastructure.Extensions;
4+
5+
namespace Relewise.Umbraco.Application;
6+
7+
public class BlogMapper : IContentTypeMapping
8+
{
9+
public Task<ContentUpdate> Map(ContentMappingContext context, CancellationToken token)
10+
{
11+
context.ContentUpdate.Content.Data["Title"] = context.PublishedContent.GetProperty("title")?.GetValue<string>(context.CulturesToPublish.First());
12+
13+
return Task.FromResult(context.ContentUpdate);
14+
}
15+
}

samples/UmbracoV9/Application/Infrastructure/CookieConsent/CookieConsent.cs renamed to Relewise.Umbraco.Application/Infrastructure/CookieConsent/CookieConsent.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
1-
using System;
21
using Microsoft.AspNetCore.Http;
32
using Newtonsoft.Json;
43

5-
namespace Relewise.UmbracoV9.Application.Infrastructure.CookieConsent;
4+
namespace Relewise.Umbraco.Application.Infrastructure.CookieConsent;
65

76
public class CookieConsent
87
{

samples/UmbracoV9/Application/Infrastructure/CookieConsent/CookieType.cs renamed to Relewise.Umbraco.Application/Infrastructure/CookieConsent/CookieType.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
namespace Relewise.UmbracoV9.Application.Infrastructure.CookieConsent;
1+
namespace Relewise.Umbraco.Application.Infrastructure.CookieConsent;
22

33
public enum CookieType
44
{
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
namespace Relewise.Umbraco.Application.Infrastructure.Extensions;
2+
3+
public static class EnumerableExtensions
4+
{
5+
public static IEnumerable<T> EmptyIfNull<T>(this IEnumerable<T>? source) where T : class
6+
{
7+
return source ?? Array.Empty<T>();
8+
}
9+
}

samples/UmbracoV9/Application/Infrastructure/Extensions/PublishedContentExtensions.cs renamed to Relewise.Umbraco.Application/Infrastructure/Extensions/PublishedContentExtensions.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
using Umbraco.Cms.Core.Models.PublishedContent;
22
using Umbraco.Extensions;
33

4-
namespace Relewise.UmbracoV9.Application.Infrastructure.Extensions;
4+
namespace Relewise.Umbraco.Application.Infrastructure.Extensions;
55

66
public static class PublishedContentExtensions
77
{
88
public static string GetTitle(this IPublishedContent content)
99
{
10-
return content.Value<string>("Title").NullIfEmpty() ?? content.Name;
10+
return content.Value<string>("Title")?.NullIfEmpty() ?? content.Name ?? string.Empty;
1111
}
1212

1313
public static string? NullIfEmpty(this string str)

samples/UmbracoV9/Application/Infrastructure/Migrations/BoozyContentMigration.cs renamed to Relewise.Umbraco.Application/Infrastructure/Migrations/BoozyContentMigration.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
using Umbraco.Cms.Infrastructure.Packaging;
22

3-
namespace Relewise.UmbracoV9.Application.Infrastructure.Migrations;
3+
namespace Relewise.Umbraco.Application.Infrastructure.Migrations;
44

55
public class BoozyContentMigration : AutomaticPackageMigrationPlan
66
{

0 commit comments

Comments
 (0)