Move projects
This commit is contained in:
7
src/OAP/Oap.Content/ContentTypes.cs
Normal file
7
src/OAP/Oap.Content/ContentTypes.cs
Normal file
@@ -0,0 +1,7 @@
|
||||
namespace Oap.Content;
|
||||
public static class ContentTypes
|
||||
{
|
||||
public const string OapApplication = nameof(OapApplication);
|
||||
public const string OapApplicationForm = nameof(OapApplicationForm);
|
||||
public const string OapApplicationFormStep = nameof(OapApplicationFormStep);
|
||||
}
|
||||
20
src/OAP/Oap.Content/Manifest.cs
Normal file
20
src/OAP/Oap.Content/Manifest.cs
Normal file
@@ -0,0 +1,20 @@
|
||||
using OrchardCore.Modules.Manifest;
|
||||
|
||||
[assembly: Module(
|
||||
Id = "OAP.Content",
|
||||
Name = "Overseas Auto Protection",
|
||||
Author = "Overseas Auto Protection",
|
||||
Website = "https://oaprotection.org/",
|
||||
Version = "0.0.1",
|
||||
Description = "The base OAP module, providing content types, parts, etc",
|
||||
Category = "Content Management",
|
||||
Dependencies = [
|
||||
"OrchardCore.ContentFields",
|
||||
"OrchardCore.Autoroute",
|
||||
"OrchardCore.Flows",
|
||||
"OrchardCore.Forms",
|
||||
"OrchardCore.Html",
|
||||
"OrchardCore.Lists",
|
||||
"OrchardCore.Title",
|
||||
]
|
||||
)]
|
||||
118
src/OAP/Oap.Content/Migrations.cs
Normal file
118
src/OAP/Oap.Content/Migrations.cs
Normal file
@@ -0,0 +1,118 @@
|
||||
using Oap.OapApplication;
|
||||
using OrchardCore.Autoroute.Models;
|
||||
using OrchardCore.ContentFields.Fields;
|
||||
using OrchardCore.ContentFields.Settings;
|
||||
using OrchardCore.ContentManagement.Metadata;
|
||||
using OrchardCore.ContentManagement.Metadata.Settings;
|
||||
using OrchardCore.Data.Migration;
|
||||
using OrchardCore.Flows.Models;
|
||||
using OrchardCore.Html.Models;
|
||||
using OrchardCore.Html.Settings;
|
||||
using OrchardCore.Lists.Models;
|
||||
using OrchardCore.Mvc.Utilities;
|
||||
using OrchardCore.Title.Models;
|
||||
|
||||
namespace Oap.Content;
|
||||
|
||||
public class Migrations : DataMigration
|
||||
{
|
||||
public Migrations(IContentDefinitionManager contentDefinitionManager)
|
||||
{
|
||||
m_contentDefinitionManager = contentDefinitionManager;
|
||||
}
|
||||
|
||||
public async Task<int> CreateAsync()
|
||||
{
|
||||
await m_contentDefinitionManager
|
||||
.AlterTypeDefinitionAsync(ContentTypes.OapApplicationFormStep, type => type
|
||||
.Securable()
|
||||
.Draftable()
|
||||
.Versionable()
|
||||
.WithPart(nameof(TitlePart), part => part
|
||||
.WithPosition("1"))
|
||||
.WithPart(nameof(AutoroutePart), part => part
|
||||
.WithPosition("2")
|
||||
.WithSettings(new AutoroutePartSettings
|
||||
{
|
||||
AllowCustomPath = true,
|
||||
AllowUpdatePath = true,
|
||||
}))
|
||||
.WithPart(nameof(FlowPart), part => part
|
||||
.WithPosition("3")));
|
||||
|
||||
await m_contentDefinitionManager
|
||||
.AlterTypeDefinitionAsync(ContentTypes.OapApplicationForm, type => type
|
||||
.Creatable()
|
||||
.Listable()
|
||||
.Securable()
|
||||
.Draftable()
|
||||
.Versionable()
|
||||
.WithPart(nameof(AutoroutePart), part => part
|
||||
.WithPosition("2")
|
||||
.WithSettings(new AutoroutePartSettings
|
||||
{
|
||||
AllowCustomPath = true,
|
||||
AllowUpdatePath = true,
|
||||
}))
|
||||
.WithPart(nameof(ListPart), part => part
|
||||
.WithDisplayName("Form Steps")
|
||||
.WithPosition("3")
|
||||
.WithSettings(new ListPartSettings
|
||||
{
|
||||
PageSize = 10,
|
||||
EnableOrdering = true,
|
||||
ContainedContentTypes = [ContentTypes.OapApplicationFormStep]
|
||||
})
|
||||
));
|
||||
|
||||
await m_contentDefinitionManager
|
||||
.AlterPartDefinitionAsync(nameof(OapApplicationPart), builder => builder
|
||||
.Attachable()
|
||||
.WithField(nameof(OapApplicationPart.Status), field => field
|
||||
.OfType(nameof(TextField))
|
||||
.WithDisplayName(nameof(OapApplicationPart.Status))
|
||||
.WithDescription("The status of the OAP Application.")
|
||||
.WithEditor("PredefinedList")
|
||||
.WithSettings(new TextFieldPredefinedListEditorSettings
|
||||
{
|
||||
Options = new[]
|
||||
{
|
||||
new ListValueOption { Name = OapApplicationStatuses.InProgress, Value = OapApplicationStatuses.InProgress.HtmlClassify() },
|
||||
new ListValueOption { Name = OapApplicationStatuses.Submitted, Value = OapApplicationStatuses.Submitted.HtmlClassify() },
|
||||
},
|
||||
DefaultValue = OapApplicationStatuses.InProgress.HtmlClassify(),
|
||||
Editor = EditorOption.Radio,
|
||||
}))
|
||||
.WithDescription("Makes a content item into an OAP Application."));
|
||||
|
||||
await m_contentDefinitionManager
|
||||
.AlterTypeDefinitionAsync(ContentTypes.OapApplication, type => type
|
||||
.Creatable()
|
||||
.Listable()
|
||||
.Securable()
|
||||
.WithPart(nameof(HtmlBodyPart), part => part
|
||||
.WithDisplayName("Notes")
|
||||
.WithSettings(new ContentTypePartSettings { Editor = "Wysiwyg", })
|
||||
)
|
||||
.WithPart(nameof(OapApplicationPart)));
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
public async Task<int> UpdateFrom1Async()
|
||||
{
|
||||
await m_contentDefinitionManager
|
||||
.AlterTypeDefinitionAsync(ContentTypes.OapApplicationFormStep, type => type
|
||||
.WithPart(nameof(HtmlBodyPart), part => part
|
||||
.WithPosition("2")
|
||||
.WithEditor("Wysiwyg")
|
||||
.WithSettings(new HtmlBodyPartSettings
|
||||
{
|
||||
SanitizeHtml = true,
|
||||
})));
|
||||
|
||||
return 2;
|
||||
}
|
||||
|
||||
private readonly IContentDefinitionManager m_contentDefinitionManager;
|
||||
}
|
||||
27
src/OAP/Oap.Content/Oap.Content.csproj
Normal file
27
src/OAP/Oap.Content/Oap.Content.csproj
Normal file
@@ -0,0 +1,27 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net8.0</TargetFramework>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="OrchardCore.Autoroute" Version="1.8.2" />
|
||||
<PackageReference Include="OrchardCore.ContentFields" Version="1.8.2" />
|
||||
<PackageReference Include="OrchardCore.Flows" Version="1.8.2" />
|
||||
<PackageReference Include="OrchardCore.Forms" Version="1.8.2" />
|
||||
<PackageReference Include="OrchardCore.Html" Version="1.8.2" />
|
||||
<PackageReference Include="OrchardCore.Lists" Version="1.8.2" />
|
||||
<PackageReference Include="OrchardCore.Module.Targets" Version="1.8.2" />
|
||||
<PackageReference Include="OrchardCore.ContentManagement" Version="1.8.2" />
|
||||
<PackageReference Include="OrchardCore.ContentTypes.Abstractions" Version="1.8.2" />
|
||||
<PackageReference Include="OrchardCore.DisplayManagement" Version="1.8.2" />
|
||||
<PackageReference Include="OrchardCore.Title" Version="1.8.2" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\Oap\Oap.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
21
src/OAP/Oap.Content/Startup.cs
Normal file
21
src/OAP/Oap.Content/Startup.cs
Normal file
@@ -0,0 +1,21 @@
|
||||
using Microsoft.AspNetCore.Builder;
|
||||
using Microsoft.AspNetCore.Routing;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Oap.OapApplication;
|
||||
using OrchardCore.Data.Migration;
|
||||
|
||||
namespace Oap.Content;
|
||||
|
||||
public class Startup : OrchardCore.Modules.StartupBase
|
||||
{
|
||||
public override void ConfigureServices(IServiceCollection services)
|
||||
{
|
||||
services.AddScoped<OapApplicationPart>();
|
||||
|
||||
services.AddDataMigration<Migrations>();
|
||||
}
|
||||
|
||||
public override void Configure(IApplicationBuilder builder, IEndpointRouteBuilder routes, IServiceProvider serviceProvider)
|
||||
{
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user