mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2025-10-15 19:54:57 +08:00
Make PAge, Blog and custom content types creatable by default
--HG-- branch : dev
This commit is contained in:
@@ -1,8 +1,16 @@
|
||||
namespace Orchard.Core.Contents.Settings {
|
||||
using Orchard.ContentManagement.MetaData.Builders;
|
||||
|
||||
namespace Orchard.Core.Contents.Settings {
|
||||
public class ContentTypeSettings {
|
||||
/// <summary>
|
||||
/// This setting is used to display a Content Type in Content Mamagement menu like
|
||||
/// </summary>
|
||||
public bool Creatable { get; set; }
|
||||
}
|
||||
|
||||
public static class MetaDataExtensions {
|
||||
public static ContentTypeDefinitionBuilder Creatable(this ContentTypeDefinitionBuilder builder, bool creatable = true) {
|
||||
return builder.WithSetting(typeof(ContentTypeSettings).Name + ".Creatable", creatable.ToString());
|
||||
}
|
||||
}
|
||||
}
|
@@ -7,4 +7,5 @@ orchardversion: 0.5.0
|
||||
features:
|
||||
Orchard.ContentTypes:
|
||||
Description: ContentTypes modules enables the creation and alteration of content types not based on code.
|
||||
Dependencies: Contents
|
||||
Category: Content
|
||||
|
@@ -126,6 +126,10 @@
|
||||
<Project>{2D1D92BB-4555-4CBE-8D0E-63563D6CE4C6}</Project>
|
||||
<Name>Orchard.Framework</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\Core\Orchard.Core.csproj">
|
||||
<Project>{9916839C-39FC-4CEB-A5AF-89CA7E87119F}</Project>
|
||||
<Name>Orchard.Core</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
|
||||
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v10.0\WebApplications\Microsoft.WebApplication.targets" />
|
||||
|
@@ -7,6 +7,7 @@ using Orchard.ContentManagement.Drivers;
|
||||
using Orchard.ContentManagement.MetaData;
|
||||
using Orchard.ContentManagement.MetaData.Models;
|
||||
using Orchard.ContentTypes.ViewModels;
|
||||
using Orchard.Core.Contents.Settings;
|
||||
using Orchard.Localization;
|
||||
|
||||
namespace Orchard.ContentTypes.Services {
|
||||
@@ -70,6 +71,7 @@ namespace Orchard.ContentTypes.Services {
|
||||
|
||||
var contentTypeDefinition = new ContentTypeDefinition(name, typeViewModel.DisplayName);
|
||||
_contentDefinitionManager.StoreTypeDefinition(contentTypeDefinition);
|
||||
_contentDefinitionManager.AlterTypeDefinition(name, cfg => cfg.Creatable());
|
||||
|
||||
return new EditTypeViewModel(contentTypeDefinition);
|
||||
}
|
||||
|
@@ -8,4 +8,5 @@ description: The pages module enables the creation and management of pages on an
|
||||
features:
|
||||
Orchard.Pages:
|
||||
Description: Simple pages.
|
||||
Dependencies: Contents
|
||||
Category: Content
|
||||
|
@@ -6,6 +6,7 @@ using Orchard.ContentManagement;
|
||||
using Orchard.ContentManagement.MetaData;
|
||||
using Orchard.Core.Common.Models;
|
||||
using Orchard.Core.Common.Settings;
|
||||
using Orchard.Core.Contents.Settings;
|
||||
using Orchard.Core.Navigation.Models;
|
||||
using Orchard.Core.Routable.Models;
|
||||
using Orchard.Core.Settings.Descriptor.Records;
|
||||
@@ -194,6 +195,7 @@ namespace Orchard.Setup.Services {
|
||||
.WithPart("CommentsPart")
|
||||
.WithPart("HasTags")
|
||||
.WithPart("Localized")
|
||||
.Creatable()
|
||||
.Indexed());
|
||||
contentDefinitionManager.AlterTypeDefinition("Page", cfg => cfg
|
||||
.DisplayedAs("Page")
|
||||
@@ -204,6 +206,7 @@ namespace Orchard.Setup.Services {
|
||||
.WithPart("CommentsPart")
|
||||
.WithPart("HasTags")
|
||||
.WithPart("Localized")
|
||||
.Creatable()
|
||||
.Indexed());
|
||||
contentDefinitionManager.AlterPartDefinition("BodyPart", cfg => cfg
|
||||
.WithSetting("BodyPartSettings.FlavorDefault", BodyPartSettings.FlavorDefaultDefault));
|
||||
|
Reference in New Issue
Block a user