Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature: default form component #1

Merged
merged 10 commits into from
Apr 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading