cms'
This commit is contained in:
1 parent
2eddb1217e
commit
6b0c4d054d
13 files changed
+209
No files matched your search
+22
@@ -0,0 +1,22 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk.Razor">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net10.0</TargetFramework>
|
||||
<AddRazorSupportForMvc>true</AddRazorSupportForMvc>
|
||||
<Nullable>enable</Nullable>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<FrameworkReference Include="Microsoft.AspNetCore.App" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="OrchardCore.Module.Targets" Version="3.0.1" />
|
||||
<PackageReference Include="OrchardCore.ContentManagement" Version="3.0.1" />
|
||||
<PackageReference Include="OrchardCore.ContentTypes.Abstractions" Version="3.0.1" />
|
||||
<PackageReference Include="OrchardCore.Data.Abstractions" Version="3.0.1" />
|
||||
<PackageReference Include="OrchardCore.DisplayManagement" Version="3.0.1" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
@@ -0,0 +1,10 @@
|
||||
using OrchardCore.Modules.Manifest;
|
||||
|
||||
[assembly: Module(
|
||||
Name = "ElectionSystem.Cms.PublicContent",
|
||||
Author = "Election System",
|
||||
Website = "https://localhost",
|
||||
Version = "1.0.0",
|
||||
Description = "Fixed public-information sections and metadata for the election CMS.",
|
||||
Category = "Content Management"
|
||||
)]
|
||||
@@ -0,0 +1,51 @@
|
||||
using OrchardCore.ContentManagement.Metadata;
|
||||
using OrchardCore.ContentManagement.Metadata.Settings;
|
||||
using OrchardCore.Data.Migration;
|
||||
|
||||
namespace ElectionSystem.Cms.PublicContent;
|
||||
|
||||
public sealed class Migrations(IContentDefinitionManager contentDefinitionManager) : DataMigration
|
||||
{
|
||||
public async Task<int> CreateAsync()
|
||||
{
|
||||
await contentDefinitionManager.AlterPartDefinitionAsync("ElectionPublicMetadataPart", part => part
|
||||
.WithDescription("公开内容的活动外部标识、适用范围和更新时间。不得保存选民身份、投票状态或计票明细。")
|
||||
.WithField("ElectionReference", field => field
|
||||
.OfType("TextField")
|
||||
.WithDisplayName("选举活动外部标识"))
|
||||
.WithField("AudienceScope", field => field
|
||||
.OfType("MultiTextField")
|
||||
.WithDisplayName("适用受众"))
|
||||
.WithField("EffectiveFromUtc", field => field
|
||||
.OfType("DateTimeField")
|
||||
.WithDisplayName("生效时间(UTC)"))
|
||||
.WithField("EffectiveToUtc", field => field
|
||||
.OfType("DateTimeField")
|
||||
.WithDisplayName("失效时间(UTC)")));
|
||||
|
||||
await CreatePublicContentTypeAsync("ElectionNotice", "选举公告");
|
||||
await CreatePublicContentTypeAsync("PolicyDocument", "规则与政策");
|
||||
await CreatePublicContentTypeAsync("CandidateDisclosure", "候选人公示");
|
||||
await CreatePublicContentTypeAsync("VoterGuide", "选民指南");
|
||||
await CreatePublicContentTypeAsync("ResultAnnouncement", "结果公告");
|
||||
await CreatePublicContentTypeAsync("PublicFaq", "常见问题");
|
||||
await CreatePublicContentTypeAsync("DownloadAsset", "资料下载");
|
||||
await CreatePublicContentTypeAsync("ArchiveRecord", "历史归档");
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
private Task CreatePublicContentTypeAsync(string name, string displayName) =>
|
||||
contentDefinitionManager.AlterTypeDefinitionAsync(name, type => type
|
||||
.WithDisplayName(displayName)
|
||||
.WithCategory("信息公开")
|
||||
.Creatable()
|
||||
.Draftable()
|
||||
.Versionable()
|
||||
.Securable()
|
||||
.WithPart("TitlePart")
|
||||
.WithPart("HtmlBodyPart")
|
||||
.WithPart("AutoroutePart")
|
||||
.WithPart("SeoMetaPart")
|
||||
.WithPart("ElectionPublicMetadataPart"));
|
||||
}
|
||||
Loaded 3 of 13 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user