cofoundry-cms / cofoundry

Cofoundry is an extensible and flexible .NET Core CMS & application framework focusing on code first development
https://www.cofoundry.org
MIT License
836 stars 146 forks source link

Show friendly enumeration item names #405

Closed JornWildt closed 2 years ago

JornWildt commented 3 years ago

I have a booking state enumeration BookingStateType and use this for a DataModel:

[Display(Name = "Bookingstatus")]
[SelectList(typeof(BookingStateType))]
public BookingStateType BookingState { get; set; }

Now I would like the booking state to show up as a friendly name in the admin system, so I add Description attributes to it (in Danish) :

public enum BookingStateType { 
  [Description("Forespørgsel")]
  Requested,

  [Description("Bekræftet")]
  Confirmed,

  [Description("Aflyst")]
  Cancelled
}

Unfortunately the admin section still shows the code names "Requested" etc. in the selected-list.

Please look for Description attributes and their values when showing select lists (and other UI forms).

HeyJoel commented 3 years ago

I'm sure we can add that. For now you should be able to use IListOptionSource to generate the options with a bit more manual effort.

HeyJoel commented 2 years ago

Fixed, will be release in v0.10