Skip to content

Commit

Permalink
Merge pull request #1 from Kentico/feat/default-form-component
Browse files Browse the repository at this point in the history
Feature: default form component
  • Loading branch information
seangwright authored Apr 30, 2024
2 parents fbf15d9 + d95985e commit 5c35c70
Show file tree
Hide file tree
Showing 23 changed files with 386 additions and 404 deletions.
4 changes: 2 additions & 2 deletions Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
<VersionSuffix>prerelease-1</VersionSuffix>
<PackageLicenseExpression>MIT</PackageLicenseExpression>

<PackageProjectUrl>https://github.com/Kentico/REPOSITORY_NAME</PackageProjectUrl>
<PackageReleaseNotes>https://github.com/Kentico/REPOSITORY_NAME/releases</PackageReleaseNotes>
<PackageProjectUrl>https://github.com/Kentico/xperience-by-kentico-labs-custom-data-types</PackageProjectUrl>
<PackageReleaseNotes>https://github.com/Kentico/xperience-by-kentico-labs-custom-data-types/releases</PackageReleaseNotes>
<PackageIcon>logo.png</PackageIcon>
<PackageReadmeFile>README.md</PackageReadmeFile>
<PackageTags>xperience;kentico;aspnetcore</PackageTags>
Expand Down
8 changes: 4 additions & 4 deletions Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@
<DisableImplicitNuGetFallbackFolder>true</DisableImplicitNuGetFallbackFolder>
</PropertyGroup>
<ItemGroup>
<PackageVersion Include="Kentico.Xperience.Admin" Version="28.4.1" />
<PackageVersion Include="Kentico.Xperience.WebApp" Version="28.4.1" />
<PackageVersion Include="kentico.xperience.azurestorage" Version="28.4.1" />
<PackageVersion Include="kentico.xperience.imageprocessing" Version="28.4.1" />
<PackageVersion Include="Kentico.Xperience.Admin" Version="29.0.1" />
<PackageVersion Include="Kentico.Xperience.WebApp" Version="29.0.1" />
<PackageVersion Include="kentico.xperience.azurestorage" Version="29.0.1" />
<PackageVersion Include="kentico.xperience.imageprocessing" Version="29.0.1" />
<PackageVersion Include="SonarAnalyzer.CSharp" Version="9.23.0.88079" />
</ItemGroup>
</Project>
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ Read the Kentico Community Portal blog post - [Embedded structured content and t

## Project version support

Xperience by Kentico 28.4.1
Xperience by Kentico 29.0.1

### Dependencies

Expand Down
Binary file modified database/DancingGoat.bak.zip
Binary file not shown.
32 changes: 25 additions & 7 deletions src/DancingGoat.Admin/AcmeWebAdminModule.cs
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
using DancingGoat.Admin;
using System.Globalization;

using CMS;
using CMS.Core;
using CMS.DataEngine.Internal;

using DancingGoat.Admin;

using Kentico.Xperience.Admin.Base;

[assembly: CMS.AssemblyDiscoverable]
[assembly: CMS.RegisterModule(typeof(AcmeWebAdminModule))]
[assembly: RegisterModule(typeof(AcmeWebAdminModule))]

// Adds a new application category
[assembly: UICategory(AcmeWebAdminModule.CUSTOM_CATEGORY, "Custom", Icons.CustomElement, 100)]

namespace DancingGoat.Admin
Expand All @@ -14,16 +18,30 @@ internal class AcmeWebAdminModule : AdminModule
{
public const string CUSTOM_CATEGORY = "acme.web.admin.category";

public AcmeWebAdminModule()
: base("Acme.Web.Admin")
public AcmeWebAdminModule() : base("Acme.Web.Admin") { }

protected override void OnPreInit(ModulePreInitParameters parameters)
{
base.OnPreInit(parameters);

AddressDataTypeRegister.Register();
LinkDataTypeRegister.Register();

RegisterDefaultValueComponent(LinkDataType.FIELD_TYPE,
LinkFormComponent.IDENTIFIER,
(val) => val is LinkDataType link ? JsonDataTypeConverter.ConvertToString(link, new(), CultureInfo.CurrentCulture).ToString() ?? "" : "",
(val) => JsonDataTypeConverter.ConvertToModel<LinkDataType>(val, new(), CultureInfo.CurrentCulture));

RegisterDefaultValueComponent(AddressDataType.FIELD_TYPE,
AddressFormComponent.IDENTIFIER,
(val) => val is AddressDataType link ? JsonDataTypeConverter.ConvertToString(link, new(), CultureInfo.CurrentCulture).ToString() ?? "" : "",
(val) => JsonDataTypeConverter.ConvertToModel<AddressDataType>(val, new(), CultureInfo.CurrentCulture));
}

protected override void OnInit()
{
base.OnInit();

// Makes the module accessible to the admin UI
RegisterClientModule("acme", "web-admin");
}
}
Expand Down
Loading

0 comments on commit 5c35c70

Please sign in to comment.