Skip to content

Commit

Permalink
Gh 69 add rfs and taxonomies/fb (#70)
Browse files Browse the repository at this point in the history
* GH-69 :: add new content types

* GH-69 :: add new content items

* GH-69 :: content item updates

* GH-69 :: add personalization

* Gh-66 :: refactor old service resolution

* GH-69 :: refactor personalization condition type

* GH-69 :: refactoring and renaming

* GH-69 :: refactoring, small adjustments

* GH-69 :: fix nullability in article service

* GH-69 :: update condition of article listing widget

* GH-72 :: update Code generation script: (#73)

- include reusable field schemas
- ensure the same namespace for RFS and other content types
- use --with-provider-class False for Custom module classes (recommended)
- extract repetitive code into a function

---------

Co-authored-by: Dominika Glueck <[email protected]>
  • Loading branch information
kentico-matthews and dominikag2 authored Sep 4, 2024
1 parent 95c839a commit 465c7b6
Show file tree
Hide file tree
Showing 100 changed files with 2,014 additions and 78 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -364,3 +364,4 @@ MigrationBackup/
FodyWeavers.xsd
src/TrainingGuides.Web/.config/dotnet-tools.json
src/TrainingGuides.Web/License/
.vscode/settings.json
65 changes: 27 additions & 38 deletions scripts/GenerateCodeFiles.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -9,53 +9,42 @@ Set-Location -Path $PSScriptRoot/../src/TrainingGuides.Web

# https://docs.xperience.io/xp/developers-and-admins/development/content-retrieval/generate-code-files-for-xperience-objects

#Reusable content types
dotnet run --no-build -- --kxp-codegen --type "ReusableContentTypes" --location "../TrainingGuides.Entities/{type}/{name}"

if ($LASTEXITCODE -ne 0) {
Write-Error "Reusable content type code generation failed."
$exitCode = 1
$contentTypesNamespace = "TrainingGuides"

function Write-Result-Get-Exit-Code {
param(
[string] $type
)
if ($LASTEXITCODE -ne 0) {
Write-Error "$type code generation failed."
return 1;
}
else{
Write-Host "$type code generation succeeded." -ForegroundColor Green
return 0;
}
Write-Host
}
else{
Write-Host "Reusable content type code generation succeeded." -ForegroundColor Green
}
Write-Host

#Reusable content types
dotnet run --no-build -- --kxp-codegen --type "ReusableContentTypes" --namespace $contentTypesNamespace --location "../TrainingGuides.Entities/{type}/{name}"
$exitCode = Write-Result-Get-Exit-Code "Reusable content type"

#Page content types
dotnet run --no-build -- --kxp-codegen --type "PageContentTypes" --location "../TrainingGuides.Entities/{type}/{name}" --skip-confirmation
dotnet run --no-build -- --kxp-codegen --type "PageContentTypes" --namespace $contentTypesNamespace --location "../TrainingGuides.Entities/{type}/{name}" --skip-confirmation
$exitCode = Write-Result-Get-Exit-Code "Page content type"

if ($LASTEXITCODE -ne 0) {
Write-Error "Page content type code generation failed."
$exitCode = 1
}
else{
Write-Host "Page content type code generation succeeded." -ForegroundColor Green
}
Write-Host
#Reusable field schemas
dotnet run --no-build -- --kxp-codegen --type "ReusableFieldSchemas" --namespace $contentTypesNamespace --location "../TrainingGuides.Entities/{type}/{name}" --skip-confirmation
$exitCode = Write-Result-Get-Exit-Code "Reusable field schema"

#Custom module classes
dotnet run --no-build -- --kxp-codegen --type "Classes" --location "../TrainingGuides.Entities/{type}/{name}" --skip-confirmation

if ($LASTEXITCODE -ne 0) {
Write-Error "Class code generation failed."
$exitCode = 1
}
else{
Write-Host "Class code generation succeeded." -ForegroundColor Green
}
Write-Host
dotnet run --no-build -- --kxp-codegen --type "Classes" --with-provider-class False --location "../TrainingGuides.Entities/{type}/{name}" --skip-confirmation
$exitCode = Write-Result-Get-Exit-Code "Class"

#Forms
dotnet run --no-build -- --kxp-codegen --type "Forms" --location "../TrainingGuides.Entities/{type}/{name}" --skip-confirmation

if ($LASTEXITCODE -ne 0) {
Write-Error "Form code generation failed."
$exitCode = 1
}
else{
Write-Host "Form code generation succeeded." -ForegroundColor Green
}
Write-Host
$exitCode = Write-Result-Get-Exit-Code "Form"

if ($exitCode -ne 0) {
Set-Location -Path $originalLocation
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,12 @@ public partial class ArticlePage : IWebPageFieldsSource
public IEnumerable<Article> ArticlePageContent { get; set; }


/// <summary>
/// ArticlePageArticleContent.
/// </summary>
public IEnumerable<IArticleSchema> ArticlePageArticleContent { get; set; }


/// <summary>
/// ArticlePagePublishDate.
/// </summary>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
//--------------------------------------------------------------------------------------------------
// <auto-generated>
//
// This code was generated by code generator tool.
//
// To customize the code use your own partial class. For more info about how to use and customize
// the generated code see the documentation at https://docs.xperience.io/.
//
// </auto-generated>
//--------------------------------------------------------------------------------------------------

using System;
using System.Collections.Generic;
using CMS.ContentEngine;

namespace TrainingGuides
{
/// <summary>
/// Represents a content item of type <see cref="GeneralArticle"/>.
/// </summary>
[RegisterContentTypeMapping(CONTENT_TYPE_NAME)]
public partial class GeneralArticle : IContentItemFieldsSource, IArticleSchema
{
/// <summary>
/// Code name of the content type.
/// </summary>
public const string CONTENT_TYPE_NAME = "TrainingGuides.GeneralArticle";


/// <summary>
/// Represents system properties for a content item.
/// </summary>
[SystemField]
public ContentItemFields SystemFields { get; set; }


/// <summary>
/// ArticleSchemaTitle.
/// </summary>
public string ArticleSchemaTitle { get; set; }


/// <summary>
/// ArticleSchemaTeaser.
/// </summary>
public IEnumerable<Asset> ArticleSchemaTeaser { get; set; }


/// <summary>
/// ArticleSchemaSummary.
/// </summary>
public string ArticleSchemaSummary { get; set; }


/// <summary>
/// ArticleSchemaText.
/// </summary>
public string ArticleSchemaText { get; set; }


/// <summary>
/// ArticleSchemaRelatedArticles.
/// </summary>
public IEnumerable<Article> ArticleSchemaRelatedArticles { get; set; }


/// <summary>
/// ArticleSchemaCategory.
/// </summary>
public IEnumerable<TagReference> ArticleSchemaCategory { get; set; }
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
//--------------------------------------------------------------------------------------------------
// <auto-generated>
//
// This code was generated by code generator tool.
//
// To customize the code use your own partial class. For more info about how to use and customize
// the generated code see the documentation at https://docs.xperience.io/.
//
// </auto-generated>
//--------------------------------------------------------------------------------------------------

using System;
using System.Collections.Generic;
using CMS.ContentEngine;

namespace TrainingGuides
{
/// <summary>
/// Represents a content item of type <see cref="Interview"/>.
/// </summary>
[RegisterContentTypeMapping(CONTENT_TYPE_NAME)]
public partial class Interview : IContentItemFieldsSource, IArticleSchema
{
/// <summary>
/// Code name of the content type.
/// </summary>
public const string CONTENT_TYPE_NAME = "TrainingGuides.Interview";


/// <summary>
/// Represents system properties for a content item.
/// </summary>
[SystemField]
public ContentItemFields SystemFields { get; set; }


/// <summary>
/// InterviewRespondantName.
/// </summary>
public string InterviewRespondantName { get; set; }


/// <summary>
/// ArticleSchemaTitle.
/// </summary>
public string ArticleSchemaTitle { get; set; }


/// <summary>
/// ArticleSchemaTeaser.
/// </summary>
public IEnumerable<Asset> ArticleSchemaTeaser { get; set; }


/// <summary>
/// ArticleSchemaSummary.
/// </summary>
public string ArticleSchemaSummary { get; set; }


/// <summary>
/// ArticleSchemaText.
/// </summary>
public string ArticleSchemaText { get; set; }


/// <summary>
/// ArticleSchemaRelatedArticles.
/// </summary>
public IEnumerable<Article> ArticleSchemaRelatedArticles { get; set; }


/// <summary>
/// ArticleSchemaCategory.
/// </summary>
public IEnumerable<TagReference> ArticleSchemaCategory { get; set; }
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
//--------------------------------------------------------------------------------------------------
// <auto-generated>
//
// This code was generated by code generator tool.
//
// To customize the code use your own partial class. For more info about how to use and customize
// the generated code see the documentation at https://docs.xperience.io/.
//
// </auto-generated>
//--------------------------------------------------------------------------------------------------

using System;
using System.Collections.Generic;
using CMS.ContentEngine;

namespace TrainingGuides
{
/// <summary>
/// Defines a contract for content types with the <see cref="IArticleSchema"/> reusable schema assigned.
/// </summary>
public interface IArticleSchema
{
/// <summary>
/// Code name of the reusable field schema.
/// </summary>
public const string REUSABLE_FIELD_SCHEMA_NAME = "ArticleSchema";


/// <summary>
/// ArticleSchemaTitle.
/// </summary>
public string ArticleSchemaTitle { get; set; }


/// <summary>
/// ArticleSchemaTeaser.
/// </summary>
public IEnumerable<Asset> ArticleSchemaTeaser { get; set; }


/// <summary>
/// ArticleSchemaSummary.
/// </summary>
public string ArticleSchemaSummary { get; set; }


/// <summary>
/// ArticleSchemaText.
/// </summary>
public string ArticleSchemaText { get; set; }


/// <summary>
/// ArticleSchemaRelatedArticles.
/// </summary>
public IEnumerable<Article> ArticleSchemaRelatedArticles { get; set; }


/// <summary>
/// ArticleSchemaCategory.
/// </summary>
public IEnumerable<TagReference> ArticleSchemaCategory { get; set; }
}
}
Loading

0 comments on commit 465c7b6

Please sign in to comment.