diff --git a/src/Orchard.Web/Modules/Orchard.ContentTypes/Controllers/AdminController.cs b/src/Orchard.Web/Modules/Orchard.ContentTypes/Controllers/AdminController.cs index 61cc18316..a26c88a73 100644 --- a/src/Orchard.Web/Modules/Orchard.ContentTypes/Controllers/AdminController.cs +++ b/src/Orchard.Web/Modules/Orchard.ContentTypes/Controllers/AdminController.cs @@ -44,16 +44,19 @@ namespace Orchard.ContentTypes.Controllers { if (!Services.Authorizer.Authorize(Permissions.CreateContentTypes, T("Not allowed to create a content type."))) return new HttpUnauthorizedResult(); - if(String.IsNullOrWhiteSpace(viewModel.DisplayName)) { - ModelState.AddModelError("DisplayName", T("The Content Type name can't be empty.").ToString()); + viewModel.DisplayName = viewModel.DisplayName ?? String.Empty; + viewModel.Name = viewModel.Name ?? String.Empty; + + if (String.IsNullOrWhiteSpace(viewModel.DisplayName)) { + ModelState.AddModelError("DisplayName", T("The Display Name name can't be empty.").ToString()); } if ( _contentDefinitionService.GetTypes().Any(t => String.Equals(t.Name.Trim(), viewModel.Name.Trim(), StringComparison.OrdinalIgnoreCase)) ) { - ModelState.AddModelError("Name", T("A type with the same technical name already exists.").ToString()); + ModelState.AddModelError("Name", T("A type with the same Id already exists.").ToString()); } if ( _contentDefinitionService.GetTypes().Any(t => String.Equals(t.DisplayName.Trim(), viewModel.DisplayName.Trim(), StringComparison.OrdinalIgnoreCase)) ) { - ModelState.AddModelError("DisplayName", T("A type with the same name already exists.").ToString()); + ModelState.AddModelError("DisplayName", T("A type with the same Name already exists.").ToString()); } if (!ModelState.IsValid) { diff --git a/src/Orchard.Web/Modules/Orchard.ContentTypes/Views/Admin/Create.cshtml b/src/Orchard.Web/Modules/Orchard.ContentTypes/Views/Admin/Create.cshtml index 5d9312b55..1ab25ecf9 100644 --- a/src/Orchard.Web/Modules/Orchard.ContentTypes/Views/Admin/Create.cshtml +++ b/src/Orchard.Web/Modules/Orchard.ContentTypes/Views/Admin/Create.cshtml @@ -5,7 +5,7 @@
@Html.TextBoxFor(m => m.DisplayName, new {@class = "textMedium", autofocus = "autofocus"}) - + @Html.TextBoxFor(m => m.Name, new {@class = "text"})
diff --git a/src/Orchard.Web/Modules/Orchard.ContentTypes/Views/Admin/Edit.cshtml b/src/Orchard.Web/Modules/Orchard.ContentTypes/Views/Admin/Edit.cshtml index 44a6fa145..81488a879 100644 --- a/src/Orchard.Web/Modules/Orchard.ContentTypes/Views/Admin/Edit.cshtml +++ b/src/Orchard.Web/Modules/Orchard.ContentTypes/Views/Admin/Edit.cshtml @@ -12,11 +12,12 @@ @Html.ValidationSummary()
- @Html.TextBoxFor(m => m.DisplayName, new { @class = "textMedium" }) @T("Technical name: {0}", Model.Name) + @Html.TextBoxFor(m => m.DisplayName, new { @class = "textMedium" }) + @T("Content Type Id: {0}", Model.Name) @* todo: if we continue to go down the midrodata route, some helpers would be nice *@ @* has unintended consequences (renamging the type) - changing the name creates a new type of that name *@ - + @Html.HiddenFor(m => m.Name)
@{ Html.RenderTemplates(Model.Templates); }