mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2025-12-03 03:58:13 +08:00
Addind a Content Type settings editor to edit Creatable and Draftable
--HG-- branch : 1.x
This commit is contained in:
@@ -51,6 +51,7 @@
|
||||
<Compile Include="AdminMenu.cs" />
|
||||
<Compile Include="ResourceManifest.cs" />
|
||||
<Compile Include="Extensions\StringExtensions.cs" />
|
||||
<Compile Include="Settings\EditorEvents.cs" />
|
||||
<Compile Include="ViewModels\AddPartsViewModel.cs" />
|
||||
<Compile Include="Controllers\AdminController.cs" />
|
||||
<Compile Include="Permissions.cs" />
|
||||
@@ -120,6 +121,9 @@
|
||||
<ItemGroup>
|
||||
<Content Include="Views\Admin\EditField.cshtml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Content Include="Views\DefinitionTemplates\ContentTypeSettings.cshtml" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
|
||||
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v10.0\WebApplications\Microsoft.WebApplication.targets" />
|
||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
using System.Collections.Generic;
|
||||
using Orchard.ContentManagement;
|
||||
using Orchard.ContentManagement.MetaData;
|
||||
using Orchard.ContentManagement.MetaData.Builders;
|
||||
using Orchard.ContentManagement.MetaData.Models;
|
||||
using Orchard.ContentManagement.ViewModels;
|
||||
using Orchard.Core.Contents.Extensions;
|
||||
using Orchard.Core.Contents.Settings;
|
||||
|
||||
namespace Orchard.ContentTypes.Settings {
|
||||
public class EditorEvents : ContentDefinitionEditorEventsBase {
|
||||
|
||||
public override IEnumerable<TemplateViewModel> TypeEditor(ContentTypeDefinition definition) {
|
||||
var model = definition.Settings.GetModel<ContentTypeSettings>();
|
||||
yield return DefinitionTemplate(model);
|
||||
}
|
||||
|
||||
public override IEnumerable<TemplateViewModel> TypeEditorUpdate(ContentTypeDefinitionBuilder builder, IUpdateModel updateModel) {
|
||||
var model = new ContentTypeSettings();
|
||||
updateModel.TryUpdateModel(model, "ContentTypeSettings", null, null);
|
||||
builder.Creatable(model.Creatable);
|
||||
builder.Draftable(model.Draftable);
|
||||
|
||||
yield return DefinitionTemplate(model);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
@model Orchard.Core.Contents.Settings.ContentTypeSettings
|
||||
|
||||
<fieldset>
|
||||
@Html.EditorFor(m => m.Creatable)
|
||||
<label for="@Html.FieldIdFor(m => m.Creatable)" class="forcheckbox">@T("Creatable")</label>
|
||||
@Html.ValidationMessageFor(m => m.Creatable)
|
||||
<span class="hint">@T("Determines if an instance of this content type can be created through the UI.")</span>
|
||||
</fieldset>
|
||||
|
||||
<fieldset>
|
||||
@Html.EditorFor(m => m.Draftable)
|
||||
<label for="@Html.FieldIdFor(m => m.Draftable)" class="forcheckbox">@T("Draftable")</label>
|
||||
@Html.ValidationMessageFor(m => m.Draftable)
|
||||
<span class="hint">@T("Determines if this content type supports draft versions.")</span>
|
||||
</fieldset>
|
||||
Reference in New Issue
Block a user