RaythaHQ / raytha

Raytha is a powerful CMS with an easy-to-use interface and fast performance. It offers custom content types, a template engine, and various access controls. It supports multiple storage providers and an automatically generated REST API. Upgrade your development workflow with Raytha.
MIT License
155 stars 30 forks source link

ViewData["ValidationErrors"] should be a dictionary #59

Closed apexdodge closed 1 year ago

apexdodge commented 1 year ago

This line here: https://github.com/RaythaHQ/raytha/blob/cbc1d9b9c735d16c43a922dc441b961d22da7493/src/Raytha.Web/Areas/Public/Controllers/BaseController.cs#L62

is supposed to be a dictionary:

ViewData["ValidationErrors"] = errors?.ToDictionary(k => k.PropertyName, v => v.ErrorMessage);

Otherwise you cannot conveniently access the error for the field by developer name in the liquid template, example:

{{ ViewData["ValidationErrors"]["name"] }}

apexdodge commented 1 year ago

Merged into dev