Make DisplayName required for ContentPart and ContentType

Work Items: 16622

--HG--
branch : dev
This commit is contained in:
Renaud Paquay
2010-11-24 09:21:35 -08:00
parent 54a6d99750
commit 332c994108
3 changed files with 5 additions and 0 deletions

View File

@@ -36,6 +36,7 @@
<ItemGroup>
<Reference Include="Microsoft.CSharp" />
<Reference Include="System" />
<Reference Include="System.ComponentModel.DataAnnotations" />
<Reference Include="System.Core">
<RequiredTargetFramework>3.5</RequiredTargetFramework>
</Reference>

View File

@@ -1,4 +1,5 @@
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using Orchard.ContentManagement.MetaData.Models;
using Orchard.ContentManagement.ViewModels;
@@ -22,6 +23,7 @@ namespace Orchard.ContentTypes.ViewModels {
public string Prefix { get { return "PartDefinition"; } }
public string Name { get; set; }
private string _displayName;
[Required]
public string DisplayName {
get { return !string.IsNullOrWhiteSpace(_displayName) ? _displayName : Name.TrimEnd("Part").CamelFriendly(); }
set { _displayName = value; }

View File

@@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using Orchard.ContentManagement.MetaData.Models;
using Orchard.ContentManagement.ViewModels;
@@ -22,6 +23,7 @@ namespace Orchard.ContentTypes.ViewModels {
}
public string Name { get; set; }
[Required]
public string DisplayName { get; set; }
public SettingsDictionary Settings { get; set; }
public IEnumerable<EditPartFieldViewModel> Fields { get; set; }