Skip to content

Commit

Permalink
Merged PR 40: Completed ASP.NET Core Example
Browse files Browse the repository at this point in the history
  • Loading branch information
nickwesselman committed Aug 3, 2020
2 parents e51a97e + ee56de9 commit 0d32e03
Show file tree
Hide file tree
Showing 101 changed files with 987 additions and 115 deletions.
9 changes: 2 additions & 7 deletions docs/_data/navigation.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,5 @@
- name: Installation
link: /install.html
- name: About the Examples
dropdown:
- name: Helix Basic Company
link: /examples/helix-basic-company.html
- name: Helix Franchise Company
link: /examples/helix-franchise-company.html
- name: Helix Corporation
link: /examples/helix-corporation.html
link: /examples/helix-basic-company.html

15 changes: 10 additions & 5 deletions docs/examples/helix-basic-company.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,15 @@ Sitecore or Sitecore Helix practices.

## Implementations

### [Helix Basic Company - ASP.NET Core and Sitecore Content Serialization](https://github.com/Sitecore/Helix.Examples/tree/master/examples/helix-basic-aspnetcore/README.md)

This is a [ASP.NET Core Rendering SDK](https://doc.sitecore.com/developers/100/developer-tools/en/sitecore-headless-development.html) and [Sitecore Content Serialization](https://doc.sitecore.com/developers/100/developer-tools/en/sitecore-content-serialization.html) based implementation of Helix Basic Company.
* The site is rendered in an independently-running rendering host, built in ASP.NET Core. Some modules contain code for both the Rendering Host and the "Platform" CM/CD roles.
* Projects which deploy to CM/CD use "platform" in their naming instead of "website" due to the use of a headless architecture.
* Items are serialized using the Sitecore CLI.
* [Helix Publishing Pipeline](https://github.com/richardszalay/helix-publishing-pipeline) is used for building and deploying code for CM/CD, and is configured to auto-deploy on build.
* The Rendering Host projects do not need Helix Publishing Pipeline, because ASP.NET Core / SDK-style projects support sharing content assets.

### [Helix Basic Company - TDS](https://github.com/Sitecore/Helix.Examples/tree/master/examples/helix-basic-tds)

This is a [Sitecore TDS](https://www.teamdevelopmentforsitecore.com/TDS-Classic)-based
Expand Down Expand Up @@ -62,8 +71,4 @@ for builds.
* A base Unicorn configuration is included in the *Serialization* Foundation module
which takes advantage of Unicorn's `$(layer)` and `$(module)` variables, but is otherwise
fairly simple and leaves each module to configure its own predicates and dependencies.
* Helix Publishing Pipeline is configured to auto-deploy on build.

### [Helix Basic Company - ASP.NET Core](https://github.com/Sitecore/Helix.Examples/tree/master/examples/helix-basic-aspnetcore/README.md)

TODO
* Helix Publishing Pipeline is configured to auto-deploy on build.
17 changes: 0 additions & 17 deletions docs/examples/helix-corporation.md

This file was deleted.

13 changes: 0 additions & 13 deletions docs/examples/helix-franchise-company.md

This file was deleted.

2 changes: 1 addition & 1 deletion docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ implementations.
Interested in exploring these examples? You can...

* Read more about the examples included in this repository by selecting from *About the Examples* above.
* [Install one or more examples](install.md) locally to explore them.
* [Run one or more examples with Docker](install.md) to explore them.
* ... or just [explore the code](https://github.com/Sitecore/Helix.Examples/tree/master/examples)!

## Intended Usage
Expand Down
14 changes: 7 additions & 7 deletions docs/install.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@ instance.
* Hardware guidelines are met
* Docker Desktop is installed
* You've switched to Windows containers
2. The default Sitecore container configuration uses specific ports. To avoid any conflicts, ensure the following ports are not being used by another process: **443, 8079, 8081, 8984, and 14330**.
3. You'll need a Sitecore license file `license.xml` handy.
1. The default Sitecore container configuration uses specific ports. To avoid any conflicts, ensure the following ports are not being used by another process: **443, 8079, 8081, 8984, and 14330**.
1. You'll need a Sitecore license file `license.xml` handy.
* If you do not have one, please reach out to your Sitecore contact.
4. [Clone the full repository](https://github.com/Sitecore/Helix.Examples) or [download it](https://github.com/Sitecore/Helix.Examples/archive/master.zip) and unzip into a local directory.
5. Follow the `README.md` instructions for each example.
1. [Clone the full repository](https://github.com/Sitecore/Helix.Examples) or [download it](https://github.com/Sitecore/Helix.Examples/archive/master.zip) and unzip into a local directory.
1. Follow the `README.md` instructions for each example.
1. [Helix Basic Company - ASP.NET Core](https://github.com/Sitecore/Helix.Examples/tree/master/examples/helix-basic-aspnetcore/README.md)
1. [Helix Basic Company - TDS](https://github.com/Sitecore/Helix.Examples/tree/master/examples/helix-basic-tds/README.md)
2. [Helix Basic Company - TDS Consolidated](https://github.com/Sitecore/Helix.Examples/tree/master/examples/helix-basic-tds-consolidated/README.md)
3. [Helix Basic Company - Unicorn](https://github.com/Sitecore/Helix.Examples/tree/master/examples/helix-basic-unicorn/README.md)
4. [Helix Basic Company - ASP.NET Core](https://github.com/Sitecore/Helix.Examples/tree/master/examples/helix-basic-aspnetcore/README.md)
1. [Helix Basic Company - TDS Consolidated](https://github.com/Sitecore/Helix.Examples/tree/master/examples/helix-basic-tds-consolidated/README.md)
1. [Helix Basic Company - Unicorn](https://github.com/Sitecore/Helix.Examples/tree/master/examples/helix-basic-unicorn/README.md)
41 changes: 31 additions & 10 deletions examples/helix-basic-aspnetcore/BasicCompany.sln
Original file line number Diff line number Diff line change
Expand Up @@ -36,22 +36,28 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Products", "Products", "{CD
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Services", "Services", "{1114AD54-BF0A-41FC-82F6-E2F5E215885C}"
ProjectSection(SolutionItems) = preProject
src\Feature\Services\Products.module.json = src\Feature\Services\Products.module.json
src\Feature\Services\Services.module.json = src\Feature\Services\Services.module.json
EndProjectSection
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Environment", "Environment", "{1EAAC5DE-019B-4D92-875D-6363F3BDEC88}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BasicCompany.Project.BasicCompany.Sitecore", "src\Project\BasicCompany\sitecore\BasicCompany.Project.BasicCompany.Sitecore.csproj", "{816F099C-E14B-4468-9E34-87F993C6484D}"
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BasicCompany.Project.BasicCompany.Platform", "src\Project\BasicCompany\platform\BasicCompany.Project.BasicCompany.Platform.csproj", "{816F099C-E14B-4468-9E34-87F993C6484D}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BasicCompany.Environment.Sitecore", "src\Environment\sitecore\BasicCompany.Environment.Sitecore.csproj", "{5C1CE88D-4FA1-44A1-A87E-E2B406B1AACD}"
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BasicCompany.Environment.Platform", "src\Environment\platform\BasicCompany.Environment.Platform.csproj", "{5C1CE88D-4FA1-44A1-A87E-E2B406B1AACD}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BasicCompany.Project.BasicCompany.Rendering", "src\Project\BasicCompany\rendering\BasicCompany.Project.BasicCompany.Rendering.csproj", "{4E282AE3-4565-45ED-8E90-22F712B336A9}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BasicCompany.Feature.BasicContent.Rendering", "src\Feature\BasicContent\rendering\BasicCompany.Feature.BasicContent.Rendering.csproj", "{C3D52ED2-50A7-4FB8-BA19-911F3AF957DB}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BasicCompany.Feature.Navigation.Sitecore", "src\Feature\Navigation\sitecore\BasicCompany.Feature.Navigation.Sitecore.csproj", "{B5A908E2-E524-4E5D-BE20-63504DA11922}"
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BasicCompany.Feature.Navigation.Platform", "src\Feature\Navigation\platform\BasicCompany.Feature.Navigation.Platform.csproj", "{B5A908E2-E524-4E5D-BE20-63504DA11922}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BasicCompany.Feature.Navigation.Rendering", "src\Feature\Navigation\rendering\BasicCompany.Feature.Navigation.Rendering.csproj", "{979A5FAB-28B9-43ED-A4D0-E111F85EF191}"
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BasicCompany.Feature.Products.Platform", "src\Feature\Products\platform\BasicCompany.Feature.Products.Platform.csproj", "{3EA47E1D-C0A1-4B03-92C0-F90A1125BBDD}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BasicCompany.Feature.Navigation.Rendering", "src\Feature\Navigation\rendering\BasicCompany.Feature.Navigation.Rendering.csproj", "{FAA57F26-12BD-4679-91D1-0F17100FE592}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BasicCompany.Feature.Products.Rendering", "src\Feature\Products\rendering\BasicCompany.Feature.Products.Rendering.csproj", "{54DD067B-96F8-49BC-BF0A-AA2C99467060}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BasicCompany.Feature.Services.Rendering", "src\Feature\Services\rendering\BasicCompany.Feature.Services.Rendering.csproj", "{A2625EF0-5F7B-4CAF-A197-8F64F13DE05B}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Expand Down Expand Up @@ -79,10 +85,22 @@ Global
{B5A908E2-E524-4E5D-BE20-63504DA11922}.Debug|Any CPU.Build.0 = Debug|Any CPU
{B5A908E2-E524-4E5D-BE20-63504DA11922}.Release|Any CPU.ActiveCfg = Release|Any CPU
{B5A908E2-E524-4E5D-BE20-63504DA11922}.Release|Any CPU.Build.0 = Release|Any CPU
{979A5FAB-28B9-43ED-A4D0-E111F85EF191}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{979A5FAB-28B9-43ED-A4D0-E111F85EF191}.Debug|Any CPU.Build.0 = Debug|Any CPU
{979A5FAB-28B9-43ED-A4D0-E111F85EF191}.Release|Any CPU.ActiveCfg = Release|Any CPU
{979A5FAB-28B9-43ED-A4D0-E111F85EF191}.Release|Any CPU.Build.0 = Release|Any CPU
{3EA47E1D-C0A1-4B03-92C0-F90A1125BBDD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{3EA47E1D-C0A1-4B03-92C0-F90A1125BBDD}.Debug|Any CPU.Build.0 = Debug|Any CPU
{3EA47E1D-C0A1-4B03-92C0-F90A1125BBDD}.Release|Any CPU.ActiveCfg = Release|Any CPU
{3EA47E1D-C0A1-4B03-92C0-F90A1125BBDD}.Release|Any CPU.Build.0 = Release|Any CPU
{FAA57F26-12BD-4679-91D1-0F17100FE592}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{FAA57F26-12BD-4679-91D1-0F17100FE592}.Debug|Any CPU.Build.0 = Debug|Any CPU
{FAA57F26-12BD-4679-91D1-0F17100FE592}.Release|Any CPU.ActiveCfg = Release|Any CPU
{FAA57F26-12BD-4679-91D1-0F17100FE592}.Release|Any CPU.Build.0 = Release|Any CPU
{54DD067B-96F8-49BC-BF0A-AA2C99467060}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{54DD067B-96F8-49BC-BF0A-AA2C99467060}.Debug|Any CPU.Build.0 = Debug|Any CPU
{54DD067B-96F8-49BC-BF0A-AA2C99467060}.Release|Any CPU.ActiveCfg = Release|Any CPU
{54DD067B-96F8-49BC-BF0A-AA2C99467060}.Release|Any CPU.Build.0 = Release|Any CPU
{A2625EF0-5F7B-4CAF-A197-8F64F13DE05B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{A2625EF0-5F7B-4CAF-A197-8F64F13DE05B}.Debug|Any CPU.Build.0 = Debug|Any CPU
{A2625EF0-5F7B-4CAF-A197-8F64F13DE05B}.Release|Any CPU.ActiveCfg = Release|Any CPU
{A2625EF0-5F7B-4CAF-A197-8F64F13DE05B}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand All @@ -99,7 +117,10 @@ Global
{4E282AE3-4565-45ED-8E90-22F712B336A9} = {2EB8DFF2-D05E-42B8-80B5-720E0BCE01BB}
{C3D52ED2-50A7-4FB8-BA19-911F3AF957DB} = {9EF7E16A-71A7-48EB-823D-E682867B311E}
{B5A908E2-E524-4E5D-BE20-63504DA11922} = {3ED9BCB0-E918-456C-991A-9B033C17D92B}
{979A5FAB-28B9-43ED-A4D0-E111F85EF191} = {3ED9BCB0-E918-456C-991A-9B033C17D92B}
{3EA47E1D-C0A1-4B03-92C0-F90A1125BBDD} = {CDB84AC1-5A02-4C07-954B-45AD9542104B}
{FAA57F26-12BD-4679-91D1-0F17100FE592} = {3ED9BCB0-E918-456C-991A-9B033C17D92B}
{54DD067B-96F8-49BC-BF0A-AA2C99467060} = {CDB84AC1-5A02-4C07-954B-45AD9542104B}
{A2625EF0-5F7B-4CAF-A197-8F64F13DE05B} = {1114AD54-BF0A-41FC-82F6-E2F5E215885C}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {7A7C4987-3A11-41A9-8915-5457EF7B5A6F}
Expand Down
2 changes: 1 addition & 1 deletion examples/helix-basic-aspnetcore/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ RUN nuget restore -Verbosity quiet
COPY src\ .\src\

# Build the Sitecore main platform artifacts
RUN msbuild .\src\Environment\sitecore\BasicCompany.Environment.Sitecore.csproj /p:Configuration=$env:BUILD_CONFIGURATION /p:DeployOnBuild=True /p:DeployDefaultTarget=WebPublish /p:WebPublishMethod=FileSystem /p:PublishUrl=C:\out\sitecore
RUN msbuild .\src\Environment\platform\BasicCompany.Environment.Platform.csproj /p:Configuration=$env:BUILD_CONFIGURATION /p:DeployOnBuild=True /p:DeployDefaultTarget=WebPublish /p:WebPublishMethod=FileSystem /p:PublishUrl=C:\out\sitecore

# Build the rendering host
WORKDIR C:\build\src\Project\BasicCompany\rendering\
Expand Down
Empty file.
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
<ProjectTypeGuids>{349c5851-65df-11da-9384-00065b846f21};{fae04ec0-301f-11d3-bf4b-00c04f79efbc}</ProjectTypeGuids>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>BasicCompany.Environment.Sitecore</RootNamespace>
<AssemblyName>BasicCompany.Environment.Sitecore</AssemblyName>
<RootNamespace>BasicCompany.Environment</RootNamespace>
<AssemblyName>BasicCompany.Environment</AssemblyName>
<TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
<UseIISExpress>true</UseIISExpress>
<Use64BitIISExpress />
Expand Down Expand Up @@ -69,8 +69,7 @@
<ItemGroup>
<Content Include="App_Config\Include\Sitecore.LoadBalancing.config" />
<Content Include="App_Config\Include\Sitecore.MediaDefaults.config" />
<Content Include="App_Config\Include\Sitecore.LinkProvider.config" />
<None Include="BasicCompany.Environment.Sitecore.wpp.targets" />
<None Include="BasicCompany.Environment.Platform.wpp.targets" />
<None Include="Directory.Build.props" />
<None Include="Properties\PublishProfiles\Local.pubxml" />
<None Include="Web.config" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<SitecoreAssembliesToExclude Include="@(SitecoreAssemblies)" />

<!-- Deployment project -->
<SitecoreAssembliesToExclude Include="BasicCompany.Environment.Sitecore.dll" />
<SitecoreAssembliesToExclude Include="BasicCompany.Environment.dll" />
<SitecoreAssembliesToExclude Include="Sitecore.LayoutService.dll" />
<SitecoreAssembliesToExclude Include="Sitecore.LayoutService.Mvc.dll" />
</ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
Referencing in Directory.build.props will prevent Visual Studio from expanding the globs when you rename a project.
-->
<ItemGroup>
<ProjectReference Include="..\..\Foundation\*\sitecore\*.csproj" />
<ProjectReference Include="..\..\Feature\*\sitecore\*.csproj" />
<ProjectReference Include="..\..\Project\*\sitecore\*.csproj" />
<ProjectReference Include="..\..\Foundation\*\platform\*.csproj" />
<ProjectReference Include="..\..\Feature\*\platform\*.csproj" />
<ProjectReference Include="..\..\Project\*\platform\*.csproj" />
</ItemGroup>
</Project>

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,9 @@ public static RenderingEngineOptions AddFeatureBasicContent(this RenderingEngine
.AddModelBoundView<PromoCard>("PromoCard")
.AddPartialView("PromoContainer")
.AddModelBoundView<SectionHeader>("SectionHeader")
.AddModelBoundView<HeroBanner>("HeroBanner");
.AddModelBoundView<HeroBanner>("HeroBanner")
.AddPartialView("Accordion")
.AddModelBoundView<AccordionItem>("AccordionItem");
return options;
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
using System;
using System.Collections.Generic;
using System.Text;
using Sitecore.AspNet.RenderingEngine.Binding.Attributes;
using Sitecore.LayoutService.Client.Response.Model.Fields;

namespace BasicCompany.Feature.BasicContent.Models
{
public class AccordionItem
{
public TextField Title { get; set; }

public RichTextField Content { get; set; }

[SitecoreContextProperty]
public bool IsEditing { get; set; }
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<div class="container accordion">
<sc-placeholder name="accordion"></sc-placeholder>
</div>
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
@model AccordionItem

@{
// always render accordions open in EE with button hidden
string bodyStyle = Model.IsEditing ? "max-height: 100rem" : null;
}
<div class="accordion-item">
<div class="accordion-header">
<h3 asp-for="Title"></h3>
<button></button>
</div>
<div class="accordion-body" style="@bodyStyle">
<sc-text asp-for="Content"></sc-text>
</div>
</div>
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@model BasicCompany.Feature.BasicContent.Models.HeroBanner
@model HeroBanner

<section class="hero is-medium is-black" style="background-image: url(@Model.Image.Value.Src)">
<div class="hero-body">
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@model BasicCompany.Feature.BasicContent.Models.PromoCard
@model PromoCard

<a asp-for="Link" editable="false" class="column promo-column">
<div class="card">
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@model BasicCompany.Feature.BasicContent.Models.SectionHeader
@model SectionHeader

<div class="container">
<h2 class="title" asp-for="Text"></h2>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
@using Sitecore.LayoutService.Client.Response.Model
@using Sitecore.LayoutService.Client.Response.Model.Fields
@using Sitecore.AspNet.RenderingEngine.Extensions
@using BasicCompany.Feature.BasicContent.Models

@addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers
@addTagHelper *, Sitecore.AspNet.RenderingEngine
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,11 +102,4 @@
</FlavorProperties>
</VisualStudio>
</ProjectExtensions>
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ public override object ResolveContents(Rendering rendering, IRenderingConfigurat
var root = RootResolver.GetNavigationRoot(this.GetContextItem(rendering, renderingConfig));
return new
{
//SITECORE TODO: Can we easily return this in a format that is EE-friendly?
FooterText = root[Templates.NavigationRoot.Fields.FooterCopyright]
};
}
Expand Down
Loading

0 comments on commit 0d32e03

Please sign in to comment.