Mercurial > altnet-hispano
changeset 152:c57ca21064f2
Auto UIHint por el nombre de la propiedad, hay un TODO para mejorarlo
author | Nelo@Guinea.neluz.int |
---|---|
date | Wed, 03 Aug 2011 00:01:49 -0300 |
parents | c03c49202280 |
children | dfb4468d8044 |
files | Agendas/trunk/src/Agendas.Web/CustomModelMetadataProvider/DataAnnotationAndConventionModelMetadataProvider.cs Agendas/trunk/src/Agendas.Web/Models/EventoModel.cs Agendas/trunk/src/Agendas.Web/Models/PropuestaModel.cs |
diffstat | 3 files changed, 5 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- a/Agendas/trunk/src/Agendas.Web/CustomModelMetadataProvider/DataAnnotationAndConventionModelMetadataProvider.cs Tue Aug 02 23:25:25 2011 -0300 +++ b/Agendas/trunk/src/Agendas.Web/CustomModelMetadataProvider/DataAnnotationAndConventionModelMetadataProvider.cs Wed Aug 03 00:01:49 2011 -0300 @@ -30,6 +30,11 @@ if (string.IsNullOrWhiteSpace(modelMetadata.Description)) modelMetadata.Description = _resolverByConvention.GetDescription(propertyName); + // Auto UIHint por property name. + // TODO: Sería ideal chequear si existe el template antes de asignarlo, ¿cómo? + if (string.IsNullOrWhiteSpace(modelMetadata.TemplateHint)) + modelMetadata.TemplateHint = propertyName; + var validators = _attributeList.OfType<ValidationAttribute>(); foreach (var validator in validators) {
--- a/Agendas/trunk/src/Agendas.Web/Models/EventoModel.cs Tue Aug 02 23:25:25 2011 -0300 +++ b/Agendas/trunk/src/Agendas.Web/Models/EventoModel.cs Wed Aug 03 00:01:49 2011 -0300 @@ -14,14 +14,12 @@ public class EventoNewModel { [Required] - [UIHint("TipoEvento")] public int TipoEvento { get; set; } [Required] public string Titulo { get; set; } [Required] - [UIHint("Ponente")] public Guid Ponente { get; set; } [Required] @@ -40,7 +38,6 @@ public string Titulo { get; set; } [Required] - [UIHint("Ponente")] public Guid Ponente { get; set; } [Required] @@ -59,7 +56,6 @@ public string Titulo { get; set; } [Required] - [UIHint("Ponente")] public Guid Ponente { get; set; } [Required]
--- a/Agendas/trunk/src/Agendas.Web/Models/PropuestaModel.cs Tue Aug 02 23:25:25 2011 -0300 +++ b/Agendas/trunk/src/Agendas.Web/Models/PropuestaModel.cs Wed Aug 03 00:01:49 2011 -0300 @@ -9,13 +9,11 @@ public class PropuestaNewModel { [Required] - [UIHint("TipoEvento")] public int TipoEvento { get; set; } [Required] public string Titulo { get; set; } - [UIHint("Ponente")] public Guid Ponente { get; set; } [Url]