mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2025-10-15 19:54:57 +08:00
Make DisplayName required for ContentPart and ContentType
Work Items: 16622 --HG-- branch : dev
This commit is contained in:
@@ -36,6 +36,7 @@
|
|||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Reference Include="Microsoft.CSharp" />
|
<Reference Include="Microsoft.CSharp" />
|
||||||
<Reference Include="System" />
|
<Reference Include="System" />
|
||||||
|
<Reference Include="System.ComponentModel.DataAnnotations" />
|
||||||
<Reference Include="System.Core">
|
<Reference Include="System.Core">
|
||||||
<RequiredTargetFramework>3.5</RequiredTargetFramework>
|
<RequiredTargetFramework>3.5</RequiredTargetFramework>
|
||||||
</Reference>
|
</Reference>
|
||||||
|
@@ -1,4 +1,5 @@
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.ComponentModel.DataAnnotations;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using Orchard.ContentManagement.MetaData.Models;
|
using Orchard.ContentManagement.MetaData.Models;
|
||||||
using Orchard.ContentManagement.ViewModels;
|
using Orchard.ContentManagement.ViewModels;
|
||||||
@@ -22,6 +23,7 @@ namespace Orchard.ContentTypes.ViewModels {
|
|||||||
public string Prefix { get { return "PartDefinition"; } }
|
public string Prefix { get { return "PartDefinition"; } }
|
||||||
public string Name { get; set; }
|
public string Name { get; set; }
|
||||||
private string _displayName;
|
private string _displayName;
|
||||||
|
[Required]
|
||||||
public string DisplayName {
|
public string DisplayName {
|
||||||
get { return !string.IsNullOrWhiteSpace(_displayName) ? _displayName : Name.TrimEnd("Part").CamelFriendly(); }
|
get { return !string.IsNullOrWhiteSpace(_displayName) ? _displayName : Name.TrimEnd("Part").CamelFriendly(); }
|
||||||
set { _displayName = value; }
|
set { _displayName = value; }
|
||||||
|
@@ -1,5 +1,6 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.ComponentModel.DataAnnotations;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using Orchard.ContentManagement.MetaData.Models;
|
using Orchard.ContentManagement.MetaData.Models;
|
||||||
using Orchard.ContentManagement.ViewModels;
|
using Orchard.ContentManagement.ViewModels;
|
||||||
@@ -22,6 +23,7 @@ namespace Orchard.ContentTypes.ViewModels {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public string Name { get; set; }
|
public string Name { get; set; }
|
||||||
|
[Required]
|
||||||
public string DisplayName { get; set; }
|
public string DisplayName { get; set; }
|
||||||
public SettingsDictionary Settings { get; set; }
|
public SettingsDictionary Settings { get; set; }
|
||||||
public IEnumerable<EditPartFieldViewModel> Fields { get; set; }
|
public IEnumerable<EditPartFieldViewModel> Fields { get; set; }
|
||||||
|
Reference in New Issue
Block a user