From 78da033df5c976cbd4768f60dd4d28ce42d5bf4e Mon Sep 17 00:00:00 2001 From: Nathan Woulfe Date: Wed, 24 Jan 2024 17:39:22 +1000 Subject: [PATCH] v13 --- .editorconfig | 6 + Directory.Build.props | 8 +- .../Preflight.Site}/.gitignore | 3 +- .../Preflight.Site}/Preflight.Site.csproj | 13 +- Examples/Preflight.Site/Program.cs | 28 + .../Properties/launchSettings.json | 6 +- Examples/Preflight.Site/Views/Author.cshtml | 30 + .../Preflight.Site/Views/AuthorList.cshtml | 4 +- .../Views/Components/Contact/Default.cshtml | 0 .../Components/Pagination/Default.cshtml | 48 + .../Views/Partials/authors.cshtml | 55 + .../Views/Partials/blockgrid/area.cshtml | 0 .../Views/Partials/blockgrid/areas.cshtml | 0 .../Views/Partials/blockgrid/default.cshtml | 0 .../Views/Partials/blockgrid/items.cshtml | 0 .../Components/codeSnippetRow.cshtml | 30 + .../blocklist/Components/iconLinkRow.cshtml | 15 + .../Components/imageCarouselRow.cshtml | 57 + .../blocklist/Components/imageRow.cshtml | 24 + .../Components/latestArticlesRow.cshtml | 76 + .../blocklist/Components/richTextRow.cshtml | 18 + .../blocklist/Components/videoRow.cshtml | 29 + .../Views/Partials/blocklist/default.cshtml | 0 .../Views/Partials/footer.cshtml | 24 + .../Partials/grid/bootstrap3-fluid.cshtml | 0 .../Views/Partials/grid/bootstrap3.cshtml | 0 .../Views/Partials/grid/editors/base.cshtml | 0 .../Views/Partials/grid/editors/embed.cshtml | 0 .../Views/Partials/grid/editors/macro.cshtml | 0 .../Views/Partials/grid/editors/media.cshtml | 0 .../Views/Partials/grid/editors/rte.cshtml | 0 .../Partials/grid/editors/textstring.cshtml | 0 .../Views/Partials/mainNavigation.cshtml | 2 +- .../Views/Partials/metaData.cshtml | 2 +- .../Views/Partials/pageHeader.cshtml | 18 +- .../Views/Partials/xmlSitemap.cshtml | 0 .../Preflight.Site}/Views/_ViewImports.cshtml | 1 - Examples/Preflight.Site/Views/article.cshtml | 23 + .../Preflight.Site/Views/articleList.cshtml | 23 + .../Preflight.Site}/Views/contact.cshtml | 0 .../Preflight.Site}/Views/content.cshtml | 8 +- .../Preflight.Site}/Views/error.cshtml | 8 +- .../Preflight.Site}/Views/home.cshtml | 18 +- .../Preflight.Site}/Views/master.cshtml | 7 +- .../Preflight.Site}/Views/search.cshtml | 35 +- .../Preflight.Site}/Views/xMLSitemap.cshtml | 0 .../appsettings.Development.json | 2 +- .../Preflight.Site}/appsettings.json | 10 +- .../clean-assets/css/highlightjs-copy.min.css | 1 + .../wwwroot/clean-assets/css/styles.css | 99 +- .../clean-assets/css/swiffy-slider.min.css | 2 + .../wwwroot/clean-assets/css/vs2015.css | 112 + .../clean-assets/js/highlight.default.min.css | 9 + .../wwwroot/clean-assets/js/highlight.min.js | 1208 + .../clean-assets/js/highlightjs-copy.min.js | 1 + .../wwwroot/clean-assets/js/initHighlight.js | 2 + .../wwwroot/clean-assets/js/scripts.js | 59 + .../clean-assets/js/swiffy-slider.min.js | 2 + .../wwwroot/css/dropdownStyles.css | 0 Examples/Preflight.Site/wwwroot/css/index.css | 23086 ++++++++++++++++ .../Preflight.Site/wwwroot/css/index.css.map | 1 + .../Preflight.Site}/wwwroot/favicon.ico | Bin Preflight.Site/Program.cs | 19 - Preflight.Site/Startup.cs | 65 - Preflight.Site/Views/BlockGridContent.cshtml | 6 - .../umbBlockGridDemoHeadlineBlock.cshtml | 4 - .../umbBlockGridDemoImageBlock.cshtml | 12 - .../umbBlockGridDemoRichTextBlock.cshtml | 6 - ...mbBlockGridDemoTwoColumnLayoutBlock.cshtml | 6 - Preflight.Site/Views/Partials/footer.cshtml | 43 - .../Views/Partials/grid/Clean.cshtml | 89 - .../Views/Partials/latestArticles.cshtml | 89 - Preflight.Site/Views/article.cshtml | 12 - .../appsettings-schema.Umbraco.Cms.json | 1778 -- .../wwwroot/clean-assets/js/scripts.js | 29 - Preflight.sln | 10 +- global.json | 4 +- .../Backoffice/gulp/config.outputPath.js | 2 +- .../Constants/KnownGridEditorAlias.cs | 8 + src/Preflight/Constants/KnownPropertyAlias.cs | 7 - .../Controllers/PreflightApiController.cs | 15 +- .../Executors/Implement/PluginExecutor.cs | 6 +- .../ServerVariablesParsingExecutor.cs | 2 +- .../Extensions/ContentTypeBaseExtensions.cs | 28 +- .../Extensions/PreflightPluginExtensions.cs | 2 +- .../Extensions/UmbracoBuilderExtensions.cs | 23 +- .../Handlers/ApplicationStartedHandler.cs | 43 - .../Handlers/ServerVariablesParsingHandler.cs | 4 +- .../Migrations/PreflightMigrationPlan.cs | 11 +- .../Migrations/Preflight_TwoZeroZero.cs | 4 +- .../Models/PreflightPropertyResponseModel.cs | 2 +- .../Models/Settings/PreflightSettingsModel.cs | 4 +- .../Models/Settings/SettingsModel.cs | 2 +- src/Preflight/Models/SimpleProperty.cs | 2 +- src/Preflight/Parsers/BlockValueParser.cs | 10 +- src/Preflight/Parsers/GridValueParser.cs | 2 +- .../Parsers/NestedContentValueParser.cs | 4 +- src/Preflight/Parsers/StringValueParser.cs | 5 +- .../Plugins/LinkHealth/LinkHealthPlugin.cs | 2 +- .../Models/SafeBrowsingResponseModel.cs | 2 +- .../Models/ThreatEntryMetadataModel.cs | 2 +- .../LinkHealth/Services/LinksService.cs | 2 +- .../Services/SafeBrowsingService.cs | 4 +- .../Readability/ReadabilityResponseModel.cs | 4 +- .../Plugins/Readability/ReadabilityService.cs | 4 +- src/Preflight/Preflight.csproj | 4 +- .../Services/Implement/ContentChecker.cs | 4 +- .../Services/Implement/SettingsService.cs | 6 +- .../Microsoft.AspNetCore.ClientAssets.targets | 11 +- src/Preflight/packages.lock.json | 865 +- version.json | 2 +- 111 files changed, 25656 insertions(+), 2827 deletions(-) rename {Preflight.Site => Examples/Preflight.Site}/.gitignore (99%) rename {Preflight.Site => Examples/Preflight.Site}/Preflight.Site.csproj (74%) create mode 100644 Examples/Preflight.Site/Program.cs rename {Preflight.Site => Examples/Preflight.Site}/Properties/launchSettings.json (80%) create mode 100644 Examples/Preflight.Site/Views/Author.cshtml rename Preflight.Site/Views/articleList.cshtml => Examples/Preflight.Site/Views/AuthorList.cshtml (79%) rename {Preflight.Site => Examples/Preflight.Site}/Views/Components/Contact/Default.cshtml (100%) create mode 100644 Examples/Preflight.Site/Views/Components/Pagination/Default.cshtml create mode 100644 Examples/Preflight.Site/Views/Partials/authors.cshtml rename {Preflight.Site => Examples/Preflight.Site}/Views/Partials/blockgrid/area.cshtml (100%) rename {Preflight.Site => Examples/Preflight.Site}/Views/Partials/blockgrid/areas.cshtml (100%) rename {Preflight.Site => Examples/Preflight.Site}/Views/Partials/blockgrid/default.cshtml (100%) rename {Preflight.Site => Examples/Preflight.Site}/Views/Partials/blockgrid/items.cshtml (100%) create mode 100644 Examples/Preflight.Site/Views/Partials/blocklist/Components/codeSnippetRow.cshtml create mode 100644 Examples/Preflight.Site/Views/Partials/blocklist/Components/iconLinkRow.cshtml create mode 100644 Examples/Preflight.Site/Views/Partials/blocklist/Components/imageCarouselRow.cshtml create mode 100644 Examples/Preflight.Site/Views/Partials/blocklist/Components/imageRow.cshtml create mode 100644 Examples/Preflight.Site/Views/Partials/blocklist/Components/latestArticlesRow.cshtml create mode 100644 Examples/Preflight.Site/Views/Partials/blocklist/Components/richTextRow.cshtml create mode 100644 Examples/Preflight.Site/Views/Partials/blocklist/Components/videoRow.cshtml rename {Preflight.Site => Examples/Preflight.Site}/Views/Partials/blocklist/default.cshtml (100%) create mode 100644 Examples/Preflight.Site/Views/Partials/footer.cshtml rename {Preflight.Site => Examples/Preflight.Site}/Views/Partials/grid/bootstrap3-fluid.cshtml (100%) rename {Preflight.Site => Examples/Preflight.Site}/Views/Partials/grid/bootstrap3.cshtml (100%) rename {Preflight.Site => Examples/Preflight.Site}/Views/Partials/grid/editors/base.cshtml (100%) rename {Preflight.Site => Examples/Preflight.Site}/Views/Partials/grid/editors/embed.cshtml (100%) rename {Preflight.Site => Examples/Preflight.Site}/Views/Partials/grid/editors/macro.cshtml (100%) rename {Preflight.Site => Examples/Preflight.Site}/Views/Partials/grid/editors/media.cshtml (100%) rename {Preflight.Site => Examples/Preflight.Site}/Views/Partials/grid/editors/rte.cshtml (100%) rename {Preflight.Site => Examples/Preflight.Site}/Views/Partials/grid/editors/textstring.cshtml (100%) rename {Preflight.Site => Examples/Preflight.Site}/Views/Partials/mainNavigation.cshtml (97%) rename {Preflight.Site => Examples/Preflight.Site}/Views/Partials/metaData.cshtml (97%) rename {Preflight.Site => Examples/Preflight.Site}/Views/Partials/pageHeader.cshtml (68%) rename {Preflight.Site => Examples/Preflight.Site}/Views/Partials/xmlSitemap.cshtml (100%) rename {Preflight.Site => Examples/Preflight.Site}/Views/_ViewImports.cshtml (93%) create mode 100644 Examples/Preflight.Site/Views/article.cshtml create mode 100644 Examples/Preflight.Site/Views/articleList.cshtml rename {Preflight.Site => Examples/Preflight.Site}/Views/contact.cshtml (100%) rename {Preflight.Site => Examples/Preflight.Site}/Views/content.cshtml (64%) rename {Preflight.Site => Examples/Preflight.Site}/Views/error.cshtml (64%) rename {Preflight.Site => Examples/Preflight.Site}/Views/home.cshtml (54%) rename {Preflight.Site => Examples/Preflight.Site}/Views/master.cshtml (73%) rename {Preflight.Site => Examples/Preflight.Site}/Views/search.cshtml (66%) rename {Preflight.Site => Examples/Preflight.Site}/Views/xMLSitemap.cshtml (100%) rename {Preflight.Site => Examples/Preflight.Site}/appsettings.Development.json (95%) rename {Preflight.Site => Examples/Preflight.Site}/appsettings.json (67%) create mode 100644 Examples/Preflight.Site/wwwroot/clean-assets/css/highlightjs-copy.min.css rename {Preflight.Site => Examples/Preflight.Site}/wwwroot/clean-assets/css/styles.css (99%) create mode 100644 Examples/Preflight.Site/wwwroot/clean-assets/css/swiffy-slider.min.css create mode 100644 Examples/Preflight.Site/wwwroot/clean-assets/css/vs2015.css create mode 100644 Examples/Preflight.Site/wwwroot/clean-assets/js/highlight.default.min.css create mode 100644 Examples/Preflight.Site/wwwroot/clean-assets/js/highlight.min.js create mode 100644 Examples/Preflight.Site/wwwroot/clean-assets/js/highlightjs-copy.min.js create mode 100644 Examples/Preflight.Site/wwwroot/clean-assets/js/initHighlight.js create mode 100644 Examples/Preflight.Site/wwwroot/clean-assets/js/scripts.js create mode 100644 Examples/Preflight.Site/wwwroot/clean-assets/js/swiffy-slider.min.js rename {Preflight.Site => Examples/Preflight.Site}/wwwroot/css/dropdownStyles.css (100%) create mode 100644 Examples/Preflight.Site/wwwroot/css/index.css create mode 100644 Examples/Preflight.Site/wwwroot/css/index.css.map rename {Preflight.Site => Examples/Preflight.Site}/wwwroot/favicon.ico (100%) delete mode 100644 Preflight.Site/Program.cs delete mode 100644 Preflight.Site/Startup.cs delete mode 100644 Preflight.Site/Views/BlockGridContent.cshtml delete mode 100644 Preflight.Site/Views/Partials/blockgrid/Components/umbBlockGridDemoHeadlineBlock.cshtml delete mode 100644 Preflight.Site/Views/Partials/blockgrid/Components/umbBlockGridDemoImageBlock.cshtml delete mode 100644 Preflight.Site/Views/Partials/blockgrid/Components/umbBlockGridDemoRichTextBlock.cshtml delete mode 100644 Preflight.Site/Views/Partials/blockgrid/Components/umbBlockGridDemoTwoColumnLayoutBlock.cshtml delete mode 100644 Preflight.Site/Views/Partials/footer.cshtml delete mode 100644 Preflight.Site/Views/Partials/grid/Clean.cshtml delete mode 100644 Preflight.Site/Views/Partials/latestArticles.cshtml delete mode 100644 Preflight.Site/Views/article.cshtml delete mode 100644 Preflight.Site/appsettings-schema.Umbraco.Cms.json delete mode 100644 Preflight.Site/wwwroot/clean-assets/js/scripts.js create mode 100644 src/Preflight/Constants/KnownGridEditorAlias.cs delete mode 100644 src/Preflight/Handlers/ApplicationStartedHandler.cs diff --git a/.editorconfig b/.editorconfig index e608686..6b7a49a 100644 --- a/.editorconfig +++ b/.editorconfig @@ -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 @@ -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 diff --git a/Directory.Build.props b/Directory.Build.props index dcda534..7c6d7b4 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -1,7 +1,7 @@ latest - net7.0 + net8.0 Nathan Woulfe Copyright © Nathan Woulfe $([System.DateTime]::Today.ToString('yyyy')) preflight.png @@ -17,9 +17,9 @@ - - - + + + diff --git a/Preflight.Site/.gitignore b/Examples/Preflight.Site/.gitignore similarity index 99% rename from Preflight.Site/.gitignore rename to Examples/Preflight.Site/.gitignore index d183720..8bcfaae 100644 --- a/Preflight.Site/.gitignore +++ b/Examples/Preflight.Site/.gitignore @@ -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/ diff --git a/Preflight.Site/Preflight.Site.csproj b/Examples/Preflight.Site/Preflight.Site.csproj similarity index 74% rename from Preflight.Site/Preflight.Site.csproj rename to Examples/Preflight.Site/Preflight.Site.csproj index c4e64d7..fc0809a 100644 --- a/Preflight.Site/Preflight.Site.csproj +++ b/Examples/Preflight.Site/Preflight.Site.csproj @@ -1,21 +1,20 @@ - net7.0 + net8.0 enable enable - false - - + + - - - + + + diff --git a/Examples/Preflight.Site/Program.cs b/Examples/Preflight.Site/Program.cs new file mode 100644 index 0000000..86de348 --- /dev/null +++ b/Examples/Preflight.Site/Program.cs @@ -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(); diff --git a/Preflight.Site/Properties/launchSettings.json b/Examples/Preflight.Site/Properties/launchSettings.json similarity index 80% rename from Preflight.Site/Properties/launchSettings.json rename to Examples/Preflight.Site/Properties/launchSettings.json index 3399bf6..3a5f880 100644 --- a/Preflight.Site/Properties/launchSettings.json +++ b/Examples/Preflight.Site/Properties/launchSettings.json @@ -4,8 +4,8 @@ "windowsAuthentication": false, "anonymousAuthentication": true, "iisExpress": { - "applicationUrl": "http://localhost:60808", - "sslPort": 44384 + "applicationUrl": "http://localhost:42312", + "sslPort": 44347 } }, "profiles": { @@ -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" } diff --git a/Examples/Preflight.Site/Views/Author.cshtml b/Examples/Preflight.Site/Views/Author.cshtml new file mode 100644 index 0000000..41b2777 --- /dev/null +++ b/Examples/Preflight.Site/Views/Author.cshtml @@ -0,0 +1,30 @@ +@inherits Umbraco.Cms.Web.Common.Views.UmbracoViewPage + +@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)) + +
+
+
+
+ +
+
+ @Model.Name +

@Model.Name

+
+
+ + @Html.GetBlockListHtml(Model.ContentRows) +
+
+
+
\ No newline at end of file diff --git a/Preflight.Site/Views/articleList.cshtml b/Examples/Preflight.Site/Views/AuthorList.cshtml similarity index 79% rename from Preflight.Site/Views/articleList.cshtml rename to Examples/Preflight.Site/Views/AuthorList.cshtml index b55301b..f0a499c 100644 --- a/Preflight.Site/Views/articleList.cshtml +++ b/Examples/Preflight.Site/Views/AuthorList.cshtml @@ -1,4 +1,4 @@ -@inherits Umbraco.Cms.Web.Common.Views.UmbracoViewPage +@inherits Umbraco.Cms.Web.Common.Views.UmbracoViewPage @using Clean.Core.Models.ViewModels @using ContentModels = Umbraco.Cms.Web.Common.PublishedModels @@ -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") \ No newline at end of file +@await Html.PartialAsync("~/Views/Partials/authors.cshtml") \ No newline at end of file diff --git a/Preflight.Site/Views/Components/Contact/Default.cshtml b/Examples/Preflight.Site/Views/Components/Contact/Default.cshtml similarity index 100% rename from Preflight.Site/Views/Components/Contact/Default.cshtml rename to Examples/Preflight.Site/Views/Components/Contact/Default.cshtml diff --git a/Examples/Preflight.Site/Views/Components/Pagination/Default.cshtml b/Examples/Preflight.Site/Views/Components/Pagination/Default.cshtml new file mode 100644 index 0000000..ac0eaf5 --- /dev/null +++ b/Examples/Preflight.Site/Views/Components/Pagination/Default.cshtml @@ -0,0 +1,48 @@ +@inherits Umbraco.Cms.Web.Common.Views.UmbracoViewPage + +@using Clean.Core.Models.ViewModels; + + \ No newline at end of file diff --git a/Examples/Preflight.Site/Views/Partials/authors.cshtml b/Examples/Preflight.Site/Views/Partials/authors.cshtml new file mode 100644 index 0000000..50f9aa4 --- /dev/null +++ b/Examples/Preflight.Site/Views/Partials/authors.cshtml @@ -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().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().Where(x => x.IsVisible()) ?? Enumerable.Empty(); + var pageOfAuthors = allAuthors.Skip((pageNumber - 1) * pageSize).Take(pageSize); + var totalItemCount = allAuthors.Count(); + var pageCount = totalItemCount > 0 ? Math.Ceiling((double)totalItemCount / pageSize) : 1; + +} + +
+
+
+
+
+ @foreach (var author in pageOfAuthors) + { +
+
+
+ @author.Name +
+
+
+

@author.Name

+

@author.MetaDescription

+ + @Umbraco.GetDictionaryValue("Author.ReadMore") + +
+
+
+
+ } +
+
+ + @if (isAuthorListPage) + { + @await Component.InvokeAsync("Pagination", new { totalItems = totalItemCount, url = Model.Url(), pageNumber = pageNumber, pageSize = pageSize }) + } +
+
+
diff --git a/Preflight.Site/Views/Partials/blockgrid/area.cshtml b/Examples/Preflight.Site/Views/Partials/blockgrid/area.cshtml similarity index 100% rename from Preflight.Site/Views/Partials/blockgrid/area.cshtml rename to Examples/Preflight.Site/Views/Partials/blockgrid/area.cshtml diff --git a/Preflight.Site/Views/Partials/blockgrid/areas.cshtml b/Examples/Preflight.Site/Views/Partials/blockgrid/areas.cshtml similarity index 100% rename from Preflight.Site/Views/Partials/blockgrid/areas.cshtml rename to Examples/Preflight.Site/Views/Partials/blockgrid/areas.cshtml diff --git a/Preflight.Site/Views/Partials/blockgrid/default.cshtml b/Examples/Preflight.Site/Views/Partials/blockgrid/default.cshtml similarity index 100% rename from Preflight.Site/Views/Partials/blockgrid/default.cshtml rename to Examples/Preflight.Site/Views/Partials/blockgrid/default.cshtml diff --git a/Preflight.Site/Views/Partials/blockgrid/items.cshtml b/Examples/Preflight.Site/Views/Partials/blockgrid/items.cshtml similarity index 100% rename from Preflight.Site/Views/Partials/blockgrid/items.cshtml rename to Examples/Preflight.Site/Views/Partials/blockgrid/items.cshtml diff --git a/Examples/Preflight.Site/Views/Partials/blocklist/Components/codeSnippetRow.cshtml b/Examples/Preflight.Site/Views/Partials/blocklist/Components/codeSnippetRow.cshtml new file mode 100644 index 0000000..18855dc --- /dev/null +++ b/Examples/Preflight.Site/Views/Partials/blocklist/Components/codeSnippetRow.cshtml @@ -0,0 +1,30 @@ +@inherits UmbracoViewPage +@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"); +} + +
+
+
@row.Code
+ @if (!string.IsNullOrWhiteSpace(row.Title)) + { +

@row.Title

+ } +
+
\ No newline at end of file diff --git a/Examples/Preflight.Site/Views/Partials/blocklist/Components/iconLinkRow.cshtml b/Examples/Preflight.Site/Views/Partials/blocklist/Components/iconLinkRow.cshtml new file mode 100644 index 0000000..ab34ffc --- /dev/null +++ b/Examples/Preflight.Site/Views/Partials/blocklist/Components/iconLinkRow.cshtml @@ -0,0 +1,15 @@ +@inherits UmbracoViewPage +@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; } +} + +
  • + + + +
  • \ No newline at end of file diff --git a/Examples/Preflight.Site/Views/Partials/blocklist/Components/imageCarouselRow.cshtml b/Examples/Preflight.Site/Views/Partials/blocklist/Components/imageCarouselRow.cshtml new file mode 100644 index 0000000..d6fbe7c --- /dev/null +++ b/Examples/Preflight.Site/Views/Partials/blocklist/Components/imageCarouselRow.cshtml @@ -0,0 +1,57 @@ +@inherits UmbracoViewPage +@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"); +} + +
    +
    +
    +
      + @foreach (var item in row.Images) + { +
    • @item.Content.GetAltText()
    • + } +
    + + + + +
    + + @if (row.Images.Count() > 1) + { + foreach (var image in row.Images.Skip(1)) + { + + } + } +
    + +
    + + @if (row.Images.Count() > 1) + { + foreach (var image in row.Images.Skip(1)) + { + + } + } +
    +
    +
    +
    \ No newline at end of file diff --git a/Examples/Preflight.Site/Views/Partials/blocklist/Components/imageRow.cshtml b/Examples/Preflight.Site/Views/Partials/blocklist/Components/imageRow.cshtml new file mode 100644 index 0000000..98869cf --- /dev/null +++ b/Examples/Preflight.Site/Views/Partials/blocklist/Components/imageRow.cshtml @@ -0,0 +1,24 @@ +@inherits UmbracoViewPage +@using Umbraco.Cms.Core.Models.Blocks +@using Clean.Core.Extensions + +@{ + var row = Model.Content as ImageRow; + var settings = Model.Settings as ImageRowSettings; + 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); + } +} + +
    + @row.Image.Content.GetAltText() + @if (!string.IsNullOrWhiteSpace(row.Caption)) + { +

    @row.Caption

    + } +
    + diff --git a/Examples/Preflight.Site/Views/Partials/blocklist/Components/latestArticlesRow.cshtml b/Examples/Preflight.Site/Views/Partials/blocklist/Components/latestArticlesRow.cshtml new file mode 100644 index 0000000..1e06e10 --- /dev/null +++ b/Examples/Preflight.Site/Views/Partials/blocklist/Components/latestArticlesRow.cshtml @@ -0,0 +1,76 @@ +@inherits UmbracoViewPage +@using Umbraco.Cms.Core.Models.Blocks +@using Clean.Core.Extensions +@using Clean.Core.Helpers + +@{ + var row = Model.Content as LatestArticlesRow; + var settings = Model.Settings as LatestArticlesRowSettings; + if (settings?.Hide ?? false) { return; } + + var spacingClasses = ""; + if (Model.Settings is ISpacingProperties spacing) + { + spacingClasses = SpacingHelper.GetSpacingClasses(spacing.PaddingTop, spacing.PaddingBottom, spacing.PaddingLeft, spacing.PaddingRight, spacing.MarginTop, spacing.MarginBottom, spacing.MarginLeft, spacing.MarginRight); + } + + var pageSize = row.PageSize; + var pageNumber = QueryStringHelper.GetIntFromQueryString(Context.Request.Query, "page", 1); + var allArticles = row.ArticleList.Children
    ().Where(x => x.IsVisible()).OrderByDescending(x => x.ArticleDate) ?? Enumerable.Empty
    (); + var pageOfArticles = allArticles.Skip((pageNumber - 1) * pageSize).Take(pageSize); + var totalItemCount = allArticles.Count(); + var pageCount = totalItemCount > 0 ? Math.Ceiling((double)totalItemCount / pageSize) : 1; +} + +
    +
    + @foreach (var article in pageOfArticles) + { + var author = article.Author; + bool.TryParse(article.Value("showFullArticleOnListPage", fallback: Fallback.ToAncestors), out var showFullArticleOnListPage); + +
    + +

    + @(!string.IsNullOrWhiteSpace(article.Title) ? article.Title : article.Name) +

    + @if (!string.IsNullOrWhiteSpace(article.Subtitle)) + { +

    @article.Subtitle

    + } +
    + + @if (showFullArticleOnListPage && article.Categories != null && article.Categories.Any()) + { + + @foreach (var category in article.Categories.Select(x => x.Name).OrderBy(y => y)) + { + @category + } + + } +
    + + @if (showFullArticleOnListPage) + { +
    +
    + @Html.GetBlockListHtml(article.ContentRows) +
    +
    + } + +
    + } + + @if (row.ShowPagination) + { + @await Component.InvokeAsync("Pagination", new { totalItems = totalItemCount, url = row.ArticleList.Url(), pageNumber = pageNumber, pageSize = pageSize }) + } +
    +
    + diff --git a/Examples/Preflight.Site/Views/Partials/blocklist/Components/richTextRow.cshtml b/Examples/Preflight.Site/Views/Partials/blocklist/Components/richTextRow.cshtml new file mode 100644 index 0000000..c894558 --- /dev/null +++ b/Examples/Preflight.Site/Views/Partials/blocklist/Components/richTextRow.cshtml @@ -0,0 +1,18 @@ +@inherits UmbracoViewPage +@using Umbraco.Cms.Core.Models.Blocks + +@{ + var row = Model.Content as RichTextRow; + var settings = Model.Settings as RichTextRowSettings; + 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); + } +} + +
    + @row.Content +
    \ No newline at end of file diff --git a/Examples/Preflight.Site/Views/Partials/blocklist/Components/videoRow.cshtml b/Examples/Preflight.Site/Views/Partials/blocklist/Components/videoRow.cshtml new file mode 100644 index 0000000..8d57cdb --- /dev/null +++ b/Examples/Preflight.Site/Views/Partials/blocklist/Components/videoRow.cshtml @@ -0,0 +1,29 @@ +@inherits UmbracoViewPage +@using Clean.Core.Helpers +@using Umbraco.Cms.Core.Models.Blocks + +@{ + var row = Model.Content as VideoRow; + var settings = Model.Settings as VideoRowSettings; + if (settings?.Hide ?? false) { return; } + if (string.IsNullOrWhiteSpace(row.VideoUrl)) { 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); + } + + var videoId = VideoUrlHelper.GetVideoId(row.VideoUrl); +} + +
    +
    +
    + @if (!string.IsNullOrWhiteSpace(row.Caption)) + { +

    @row.Caption

    + } +
    +
    + diff --git a/Preflight.Site/Views/Partials/blocklist/default.cshtml b/Examples/Preflight.Site/Views/Partials/blocklist/default.cshtml similarity index 100% rename from Preflight.Site/Views/Partials/blocklist/default.cshtml rename to Examples/Preflight.Site/Views/Partials/blocklist/default.cshtml diff --git a/Examples/Preflight.Site/Views/Partials/footer.cshtml b/Examples/Preflight.Site/Views/Partials/footer.cshtml new file mode 100644 index 0000000..f4d2074 --- /dev/null +++ b/Examples/Preflight.Site/Views/Partials/footer.cshtml @@ -0,0 +1,24 @@ +@inherits UmbracoViewPage +@using ContentModels = Umbraco.Cms.Web.Common.PublishedModels + +@{ + var homePage = Model.AncestorOrSelf(); +} + + +
    +
    +
    +
    + @if (homePage.SocialIconLinks != null && homePage.SocialIconLinks.Any()) + { +
      + @Html.GetBlockListHtml(homePage.SocialIconLinks) +
    + } +

    @Umbraco.GetDictionaryValue("Footer.CopyrightTitle") © @DateTime.Now.Year @Umbraco.GetDictionaryValue("Footer.CopyrightStatement")

    +

    Theme by Start Bootstrap, implemented in Umbraco by Paul Seal from codeshare.co.uk

    +
    +
    +
    +
    diff --git a/Preflight.Site/Views/Partials/grid/bootstrap3-fluid.cshtml b/Examples/Preflight.Site/Views/Partials/grid/bootstrap3-fluid.cshtml similarity index 100% rename from Preflight.Site/Views/Partials/grid/bootstrap3-fluid.cshtml rename to Examples/Preflight.Site/Views/Partials/grid/bootstrap3-fluid.cshtml diff --git a/Preflight.Site/Views/Partials/grid/bootstrap3.cshtml b/Examples/Preflight.Site/Views/Partials/grid/bootstrap3.cshtml similarity index 100% rename from Preflight.Site/Views/Partials/grid/bootstrap3.cshtml rename to Examples/Preflight.Site/Views/Partials/grid/bootstrap3.cshtml diff --git a/Preflight.Site/Views/Partials/grid/editors/base.cshtml b/Examples/Preflight.Site/Views/Partials/grid/editors/base.cshtml similarity index 100% rename from Preflight.Site/Views/Partials/grid/editors/base.cshtml rename to Examples/Preflight.Site/Views/Partials/grid/editors/base.cshtml diff --git a/Preflight.Site/Views/Partials/grid/editors/embed.cshtml b/Examples/Preflight.Site/Views/Partials/grid/editors/embed.cshtml similarity index 100% rename from Preflight.Site/Views/Partials/grid/editors/embed.cshtml rename to Examples/Preflight.Site/Views/Partials/grid/editors/embed.cshtml diff --git a/Preflight.Site/Views/Partials/grid/editors/macro.cshtml b/Examples/Preflight.Site/Views/Partials/grid/editors/macro.cshtml similarity index 100% rename from Preflight.Site/Views/Partials/grid/editors/macro.cshtml rename to Examples/Preflight.Site/Views/Partials/grid/editors/macro.cshtml diff --git a/Preflight.Site/Views/Partials/grid/editors/media.cshtml b/Examples/Preflight.Site/Views/Partials/grid/editors/media.cshtml similarity index 100% rename from Preflight.Site/Views/Partials/grid/editors/media.cshtml rename to Examples/Preflight.Site/Views/Partials/grid/editors/media.cshtml diff --git a/Preflight.Site/Views/Partials/grid/editors/rte.cshtml b/Examples/Preflight.Site/Views/Partials/grid/editors/rte.cshtml similarity index 100% rename from Preflight.Site/Views/Partials/grid/editors/rte.cshtml rename to Examples/Preflight.Site/Views/Partials/grid/editors/rte.cshtml diff --git a/Preflight.Site/Views/Partials/grid/editors/textstring.cshtml b/Examples/Preflight.Site/Views/Partials/grid/editors/textstring.cshtml similarity index 100% rename from Preflight.Site/Views/Partials/grid/editors/textstring.cshtml rename to Examples/Preflight.Site/Views/Partials/grid/editors/textstring.cshtml diff --git a/Preflight.Site/Views/Partials/mainNavigation.cshtml b/Examples/Preflight.Site/Views/Partials/mainNavigation.cshtml similarity index 97% rename from Preflight.Site/Views/Partials/mainNavigation.cshtml rename to Examples/Preflight.Site/Views/Partials/mainNavigation.cshtml index ed025c6..5b21600 100644 --- a/Preflight.Site/Views/Partials/mainNavigation.cshtml +++ b/Examples/Preflight.Site/Views/Partials/mainNavigation.cshtml @@ -18,7 +18,7 @@ - @foreach (var page in homePage.Children.Where(x => !x.Value("umbracoNaviHide"))) + @foreach (var page in homePage.Children.Where(x => !x.Value("hideFromTopNavigation"))) {