Skip to content

Commit

Permalink
Upgrade to Umbraco 11
Browse files Browse the repository at this point in the history
  • Loading branch information
patrickdemooij9 committed Dec 4, 2022
1 parent 6952d60 commit 03645a0
Show file tree
Hide file tree
Showing 10 changed files with 1,902 additions and 11 deletions.
6 changes: 3 additions & 3 deletions source/SimpleRedirects.Core/SimpleRedirects.Core.csproj
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net7.0</TargetFramework>
<ContentTargetFolders>.</ContentTargetFolders>
<Product>SimpleRedirects.Core</Product>
<PackageId>SimpleRedirects.Core</PackageId>
Expand All @@ -13,7 +13,7 @@
<PackageIconUrl>https://raw.githubusercontent.com/patrickdemooij9/SimpleRedirects/v9/main/package/simpleRedirectsLogo.png</PackageIconUrl>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Umbraco.Cms.Web.Website" Version="10.0.0" />
<PackageReference Include="Umbraco.Cms.Web.BackOffice" Version="10.0.0" />
<PackageReference Include="Umbraco.Cms.Web.Website" Version="11.0.0" />
<PackageReference Include="Umbraco.Cms.Web.BackOffice" Version="11.0.0" />
</ItemGroup>
</Project>
8 changes: 6 additions & 2 deletions source/SimpleRedirects.Site/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,11 @@ public static void Main(string[] args)

public static IHostBuilder CreateHostBuilder(string[] args) =>
Host.CreateDefaultBuilder(args)
.ConfigureLogging(x => x.ClearProviders())
.ConfigureWebHostDefaults(webBuilder => webBuilder.UseStartup<Startup>());
.ConfigureUmbracoDefaults()
.ConfigureWebHostDefaults(webBuilder =>
{
webBuilder.UseStaticWebAssets();
webBuilder.UseStartup<Startup>();
});
}
}
4 changes: 2 additions & 2 deletions source/SimpleRedirects.Site/SimpleRedirects.Site.csproj
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net7.0</TargetFramework>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Umbraco.Cms" Version="10.0.0" />
<PackageReference Include="Umbraco.Cms" Version="11.0.0" />
</ItemGroup>

<Import Project="..\SimpleRedirects\build\SimpleRedirects.targets" />
Expand Down
10 changes: 10 additions & 0 deletions source/SimpleRedirects.Site/Views/Partials/blockgrid/area.cshtml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
@using Umbraco.Extensions
@inherits Umbraco.Cms.Web.Common.Views.UmbracoViewPage<Umbraco.Cms.Core.Models.Blocks.BlockGridArea>

<div class="umb-block-grid__area"
data-area-col-span="@Model.ColumnSpan"
data-area-row-span="@Model.RowSpan"
data-area-alias="@Model.Alias"
style="--umb-block-grid--grid-columns: @Model.ColumnSpan;--umb-block-grid--area-column-span: @Model.ColumnSpan; --umb-block-grid--area-row-span: @Model.RowSpan;">
@await Html.GetBlockGridItemsHtmlAsync(Model)
</div>
13 changes: 13 additions & 0 deletions source/SimpleRedirects.Site/Views/Partials/blockgrid/areas.cshtml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
@using Umbraco.Extensions
@inherits Umbraco.Cms.Web.Common.Views.UmbracoViewPage<Umbraco.Cms.Core.Models.Blocks.BlockGridItem>
@{
if (Model?.Areas.Any() != true) { return; }
}

<div class="umb-block-grid__area-container"
style="--umb-block-grid--area-grid-columns: @(Model.AreaGridColumns?.ToString() ?? Model.GridColumns?.ToString() ?? "12");">
@foreach (var area in Model.Areas)
{
@await Html.GetBlockGridItemAreaHtmlAsync(area)
}
</div>
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
@using Umbraco.Extensions
@inherits Umbraco.Cms.Web.Common.Views.UmbracoViewPage<Umbraco.Cms.Core.Models.Blocks.BlockGridModel>
@{
if (Model?.Any() != true) { return; }
}

<div class="umb-block-grid"
data-grid-columns="@(Model.GridColumns?.ToString() ?? "12");"
style="--umb-block-grid--grid-columns: @(Model.GridColumns?.ToString() ?? "12");">
@await Html.GetBlockGridItemsHtmlAsync(Model)
</div>
35 changes: 35 additions & 0 deletions source/SimpleRedirects.Site/Views/Partials/blockgrid/items.cshtml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
@using Umbraco.Cms.Core.Models.Blocks
@inherits Umbraco.Cms.Web.Common.Views.UmbracoViewPage<IEnumerable<BlockGridItem>>
@{
if (Model?.Any() != true) { return; }
}

<div class="umb-block-grid__layout-container">
@foreach (var item in Model)
{
<div
class="umb-block-grid__layout-item"
data-content-element-type-alias="@item.Content.ContentType.Alias"
data-content-element-type-key="@item.Content.ContentType.Key"
data-element-udi="@item.ContentUdi"
data-col-span="@item.ColumnSpan"
data-row-span="@item.RowSpan"
style=" --umb-block-grid--item-column-span: @item.ColumnSpan; --umb-block-grid--item-row-span: @item.RowSpan; ">
@{
var partialViewName = "blockgrid/Components/" + item.Content.ContentType.Alias;
try
{
@await Html.PartialAsync(partialViewName, item)
}
catch (InvalidOperationException)
{
<p>
<strong>Could not render component of type: @(item.Content.ContentType.Alias)</strong>
<br/>
This likely happened because the partial view <em>@partialViewName</em> could not be found.
</p>
}
}
</div>
}
</div>
Loading

0 comments on commit 03645a0

Please sign in to comment.