Skip to content

Commit

Permalink
v13
Browse files Browse the repository at this point in the history
  • Loading branch information
nathanwoulfe committed Jan 24, 2024
1 parent a350c2c commit 78da033
Show file tree
Hide file tree
Showing 111 changed files with 25,656 additions and 2,827 deletions.
6 changes: 6 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,9 @@ csharp_style_expression_bodied_accessors = true:suggestion
csharp_style_expression_bodied_lambdas = true:suggestion
csharp_style_expression_bodied_local_functions = true:suggestion
csharp_indent_labels = no_change
csharp_style_prefer_primary_constructors = true:none
csharp_style_allow_embedded_statements_on_same_line_experimental = true:silent
dotnet_diagnostic.SA1010.severity = none

##########################################
# File Extension Settings
Expand Down Expand Up @@ -415,3 +418,6 @@ end_of_line = crlf
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
# OTHER DEALINGS IN THE SOFTWARE.
##########################################

# IDE0290: Use primary constructor
dotnet_diagnostic.IDE0290.severity = none
8 changes: 4 additions & 4 deletions Directory.Build.props
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project>
<PropertyGroup>
<LangVersion>latest</LangVersion>
<TargetFramework>net7.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<Authors>Nathan Woulfe</Authors>
<Copyright>Copyright © Nathan Woulfe $([System.DateTime]::Today.ToString('yyyy'))</Copyright>
<PackageIcon>preflight.png</PackageIcon>
Expand All @@ -17,9 +17,9 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Nerdbank.GitVersioning" Version="3.5.113" PrivateAssets="all" IsImplicitlyDefined="true" />
<PackageReference Include="StyleCop.Analyzers" Version="1.2.0-beta.435" PrivateAssets="all" IsImplicitlyDefined="true" />
<PackageReference Include="Umbraco.Code" Version="2.0.0" PrivateAssets="all" IsImplicitlyDefined="true" />
<PackageReference Include="Nerdbank.GitVersioning" Version="3.6.128" PrivateAssets="all" IsImplicitlyDefined="true" />
<PackageReference Include="StyleCop.Analyzers" Version="1.2.0-beta.507" PrivateAssets="all" IsImplicitlyDefined="true" />
<PackageReference Include="Umbraco.Code" Version="2.1.0" PrivateAssets="all" IsImplicitlyDefined="true" />
<PackageReference Include="Umbraco.GitVersioning.Extensions" Version="0.2.0" PrivateAssets="all" IsImplicitlyDefined="true" />
</ItemGroup>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -457,8 +457,9 @@ $RECYCLE.BIN/
## Umbraco CMS
##

# JSON schema file for appsettings.json
# JSON schema files for appsettings.json
appsettings-schema.json
appsettings-schema.*.json

# Packages created from the backoffice (package.xml/package.zip)
/umbraco/Data/CreatedPackages/
Expand Down
Original file line number Diff line number Diff line change
@@ -1,21 +1,20 @@
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>net7.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<IsPackable>false</IsPackable>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="clean" Version="2.1.6" />
<PackageReference Include="Umbraco.Cms" Version="[12.0.0, 13)" />
<PackageReference Include="Clean" Version="4.0.0" />
<PackageReference Include="Umbraco.Cms" Version="13.0.3" />
</ItemGroup>

<ItemGroup>
<!-- Opt-in to app-local ICU to ensure consistent globalization APIs across different platforms -->
<PackageReference Include="Microsoft.ICU.ICU4C.Runtime" Version="68.2.0.9" />
<ProjectReference Include="..\src\Preflight\Preflight.csproj" />
<RuntimeHostConfigurationOption Include="System.Globalization.AppLocalIcu" Value="68.2.0.9" Condition="$(RuntimeIdentifier.StartsWith('linux')) or $(RuntimeIdentifier.StartsWith('win')) or ('$(RuntimeIdentifier)' == '' and !$([MSBuild]::IsOSPlatform('osx')))" />
<PackageReference Include="Microsoft.ICU.ICU4C.Runtime" Version="72.1.0.3" />
<ProjectReference Include="..\..\src\Preflight\Preflight.csproj" />
<RuntimeHostConfigurationOption Include="System.Globalization.AppLocalIcu" Value="72.1.0.3" Condition="$(RuntimeIdentifier.StartsWith('linux')) or $(RuntimeIdentifier.StartsWith('win')) or ('$(RuntimeIdentifier)' == '' and !$([MSBuild]::IsOSPlatform('osx')))" />
</ItemGroup>

<PropertyGroup>
Expand Down
28 changes: 28 additions & 0 deletions Examples/Preflight.Site/Program.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
WebApplicationBuilder builder = WebApplication.CreateBuilder(args);

builder.CreateUmbracoBuilder()
.AddBackOffice()
.AddWebsite()
.AddDeliveryApi()
.AddComposers()
.Build();

WebApplication app = builder.Build();

await app.BootUmbracoAsync();


app.UseUmbraco()
.WithMiddleware(u =>
{
u.UseBackOffice();
u.UseWebsite();
})
.WithEndpoints(u =>
{
u.UseInstallerEndpoints();
u.UseBackOfficeEndpoints();
u.UseWebsiteEndpoints();
});

await app.RunAsync();
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
"windowsAuthentication": false,
"anonymousAuthentication": true,
"iisExpress": {
"applicationUrl": "http://localhost:60808",
"sslPort": 44384
"applicationUrl": "http://localhost:42312",
"sslPort": 44347
}
},
"profiles": {
Expand All @@ -20,7 +20,7 @@
"commandName": "Project",
"dotnetRunMessages": true,
"launchBrowser": true,
"applicationUrl": "https://localhost:44384;http://localhost:60808",
"applicationUrl": "https://localhost:44347;http://localhost:42312",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
Expand Down
30 changes: 30 additions & 0 deletions Examples/Preflight.Site/Views/Author.cshtml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
@inherits Umbraco.Cms.Web.Common.Views.UmbracoViewPage<ContentModels.Author>

@using Clean.Core.Models.ViewModels
@using ContentModels = Umbraco.Cms.Web.Common.PublishedModels

@{
Layout = "master.cshtml";
var authorListPage = Model.Parent as AuthorList;
}


@await Html.PartialAsync("~/Views/Partials/pageHeader.cshtml", new PageHeaderViewModel(Model.Name, Model.Title, Model.Subtitle, authorListPage.MainImage, null, null))

<article>
<div class="container">
<div class="row">
<div class="col-lg-8 col-md-10 mx-auto">

<div class="row clearfix">
<div class="col-md-4 column mx-auto">
<img src="@Model.MainImage.GetCropUrl(400)" alt="@Model.Name" class="w-100">
<p class="caption">@Model.Name</p>
</div>
</div>

@Html.GetBlockListHtml(Model.ContentRows)
</div>
</div>
</div>
</article>
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@inherits Umbraco.Cms.Web.Common.Views.UmbracoViewPage<ContentModels.ArticleList>
@inherits Umbraco.Cms.Web.Common.Views.UmbracoViewPage<ContentModels.AuthorList>

@using Clean.Core.Models.ViewModels
@using ContentModels = Umbraco.Cms.Web.Common.PublishedModels
Expand All @@ -9,4 +9,4 @@

@await Html.PartialAsync("~/Views/Partials/pageHeader.cshtml", new PageHeaderViewModel(Model.Name, Model.Title, Model.Subtitle, Model.MainImage))

@await Html.PartialAsync("~/Views/Partials/latestArticles.cshtml")
@await Html.PartialAsync("~/Views/Partials/authors.cshtml")
48 changes: 48 additions & 0 deletions Examples/Preflight.Site/Views/Components/Pagination/Default.cshtml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
@inherits Umbraco.Cms.Web.Common.Views.UmbracoViewPage<PaginationViewModel>

@using Clean.Core.Models.ViewModels;

<nav aria-label="Pagination controls">
@if (Model.PageCount > 1)
{
<ul class="pagination justify-content-center">
@if (Model.PageNumber > 1)
{
<li class="page-item">
<a class="page-link text-primary" href="@($"{Model.Url}?page={Model.PageNumber - 1}")">@Umbraco.GetDictionaryValue("Paging.Previous")</a>
</li>
}
@if(Model.ShowFirst)
{
<li class="page-item">
<a class="page-link" href="@($"{Model.Url}?page={1}")">1</a>
</li>
<li class="page-item disabled">
<a class="page-link" href="#">...</a>
</li>
}

@for (var p = Model.PageNumberStart; p <= Model.PageNumberEnd; p++)
{
var isCurrentPage = p == Model.PageNumber;
<li class="page-item">
@if(isCurrentPage)
{
@:<strong>
}
<a class="page-link @(isCurrentPage ? "text-primary" : null)" href="@($"{Model.Url}?page={p}")">@p</a>
@if(isCurrentPage)
{
@:</strong>
}
</li>
}
@if (Model.PageNumber < Model.PageCount)
{
<li class="page-item">
<a class="page-link text-primary" href="@($"{Model.Url}?page={Model.PageNumber + 1}")">@Umbraco.GetDictionaryValue("Paging.Next")</a>
</li>
}
</ul>
}
</nav>
55 changes: 55 additions & 0 deletions Examples/Preflight.Site/Views/Partials/authors.cshtml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
@inherits UmbracoViewPage

@using Clean.Core.Helpers
@using Clean.Core.Models.ViewModels;
@using ContentModels = Umbraco.Cms.Web.Common.PublishedModels

@{
AuthorList authorList = UmbracoContext.Content.GetAtRoot().DescendantsOrSelf<AuthorList>().FirstOrDefault();
int modelId = Model.Id;
var isAuthorListPage = modelId == authorList?.Id;
var fallbackPageSize = isAuthorListPage ? 10 : 3;

var pageSize = QueryStringHelper.GetIntFromQueryString(Context.Request.Query, "size", fallbackPageSize);
var pageNumber = QueryStringHelper.GetIntFromQueryString(Context.Request.Query, "page", 1);
var allAuthors = authorList?.Children<Author>().Where(x => x.IsVisible()) ?? Enumerable.Empty<Author>();
var pageOfAuthors = allAuthors.Skip((pageNumber - 1) * pageSize).Take(pageSize);
var totalItemCount = allAuthors.Count();
var pageCount = totalItemCount > 0 ? Math.Ceiling((double)totalItemCount / pageSize) : 1;

}

<div class="container">
<div class="row">
<div class="col-lg-8 col-md-10 mx-auto">
<div class="container-fluid">
<div class="row">
@foreach (var author in pageOfAuthors)
{
<div class="col-4 mx-auto">
<div class="card">
<header>
<img src="@(author.MainImage.Url())" alt="@author.Name" class="w-100" />
</header>
<div class="card-body">
<div class="content-left text-start my-auto py-4">
<h2 class="card-title">@author.Name</h2>
<p class="card-description">@author.MetaDescription</p>
<a href="@author.Url()" class="text-primary">
@Umbraco.GetDictionaryValue("Author.ReadMore")
</a>
</div>
</div>
</div>
</div>
}
</div>
</div>

@if (isAuthorListPage)
{
@await Component.InvokeAsync("Pagination", new { totalItems = totalItemCount, url = Model.Url(), pageNumber = pageNumber, pageSize = pageSize })
}
</div>
</div>
</div>
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
@inherits UmbracoViewPage<BlockListItem>
@using Umbraco.Cms.Core.Models.Blocks

@{
var row = Model.Content as CodeSnippetRow;
var settings = Model.Settings as CodeSnippetRowSettings;
if (settings?.Hide ?? false) { return; }

var spacingClasses = "";
if (Model.Settings is ISpacingProperties spacing)
{
spacingClasses = Clean.Core.Helpers.SpacingHelper.GetSpacingClasses(spacing.PaddingTop, spacing.PaddingBottom, spacing.PaddingLeft, spacing.PaddingRight, spacing.MarginTop, spacing.MarginBottom, spacing.MarginLeft, spacing.MarginRight);
}

SmidgeHelper.RequiresCss("~/clean-assets/css/vs2015.css");
SmidgeHelper.RequiresCss("~/clean-assets/css/highlightjs-copy.min.css");
SmidgeHelper.RequiresJs("~/clean-assets/js/highlight.min.js");
SmidgeHelper.RequiresJs("~/clean-assets/js/highlightjs-copy.min.js");
SmidgeHelper.RequiresJs("~/clean-assets/js/initHighlight.js");
}

<div class="row clearfix @(spacingClasses)">
<div class="col-md-12 column">
<pre><code>@row.Code</code></pre>
@if (!string.IsNullOrWhiteSpace(row.Title))
{
<p class="caption">@row.Title</p>
}
</div>
</div>
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
@inherits UmbracoViewPage<BlockListItem>
@using Umbraco.Cms.Core.Models.Blocks
@addTagHelper *, Clean.Core

@{
var row = Model.Content as IconLinkRow;
var settings = Model.Settings as IconLinkRowSettings;
if (settings?.Hide ?? false) { return; }
}

<li class="list-inline-item">
<a href="@row.Link.Url" target="@row.Link.Target" rel="@(row.Link.Type == global::Umbraco.Cms.Core.Models.LinkType.External ? "noopener" : null)" title="@row.Link.Name">
<our-svg media-item="@row.Icon" class="social-icon"></our-svg>
</a>
</li>
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
@inherits UmbracoViewPage<BlockListItem>
@using Umbraco.Cms.Core.Models.Blocks
@using Clean.Core.Extensions

@{
var row = Model.Content as ImageCarouselRow;
var settings = Model.Settings as ImageCarouselRowSettings;
if (settings?.Hide ?? false) { return; }
if (row.Images == null || !row.Images.Any()) { return; }

var spacingClasses = "";
if (Model.Settings is ISpacingProperties spacing)
{
spacingClasses = Clean.Core.Helpers.SpacingHelper.GetSpacingClasses(spacing.PaddingTop, spacing.PaddingBottom, spacing.PaddingLeft, spacing.PaddingRight, spacing.MarginTop, spacing.MarginBottom, spacing.MarginLeft, spacing.MarginRight);
}

SmidgeHelper.RequiresCss("~/clean-assets/css/swiffy-slider.min.css");
SmidgeHelper.RequiresJs("~/clean-assets/js/swiffy-slider.min.js");
}

<div class="row clearfix @(spacingClasses)">
<div class="col-md-12 column">
<div class="swiffy-slider slider-item-reveal slider-nav-round slider-item-ratio slider-item-ratio-4x3" id="slider-@(row.Key.ToString())">
<ul class="slider-container">
@foreach (var item in row.Images)
{
<li><img src="@item.Url()" loading="lazy" alt="@item.Content.GetAltText()"></li>
}
</ul>

<button type="button" class="slider-nav" aria-label="Go left"></button>
<button type="button" class="slider-nav slider-nav-next" aria-label="Go right"></button>

<div class="slider-indicators slider-indicators-square d-none d-md-flex">
<button class="active" aria-label="Go to slide"></button>
@if (row.Images.Count() > 1)
{
foreach (var image in row.Images.Skip(1))
{
<button aria-label="Go to slide"></button>
}
}
</div>

<div class="slider-indicators slider-indicators-sm slider-indicators-dark slider-indicators-round d-md-none slider-indicators-highlight">
<button class="active" aria-label="Go to slide"></button>
@if (row.Images.Count() > 1)
{
foreach (var image in row.Images.Skip(1))
{
<button aria-label="Go to slide"></button>
}
}
</div>
</div>
</div>
</div>
Loading

0 comments on commit 78da033

Please sign in to comment.