0
Completed

Add required input html extension

Adam van Vliet 12 years ago updated by anonymous 9 years ago 5

From IDB-528, please create a html extension to render required fields; additionally determine the best way this can be represented on the UI.

Because we couldn't override the internal LabelFor methods of the HtmlHelper (and inject our own), i've instead opted to include a container extension for these details, as opposed to separate extensions entirely.

Namely, now a standard implementation of a View information property in either product on the view will look similar to this:

@using (Html.MetaDataFor(model => model.Property, new{description = Resources.PropertyDescription})
{
   @Html.LabelFor(model => model.Property)
   @Html.TextBoxFor(model => model.Property)
}

as opposed to

<div>
   @Html.LabelFor(model => model.Property)
   @Html.TextBoxFor(model => model.Property)
   <span class=\"hint\">Resources.PropertyDescription<span class=\"hint-pointer\">&nbsp;</span></span>
   <noscript><p class=\"note\">Resources.PropertyDescription<</p></noscript>
</div>

Of note is the fact that the hint spans are now gone, replaced by the description metadata which renders that for us. Additional meta-data writers can be added so we can add extensible meta data properties to the collection.

Additionally, we might be able to update these writers to write the javascript that shows/hides the sections for us, so that all you'd need to do is attach a RequiredIfTrue attribute to the view information property of choice.

Reassigned for confirmation of completion.

Reopened for method that does not require a model.

Added methods to allow for the meta data stuff to be used without a model. Also removed the factories from IdB and EB and put that in the base controller.

Required attributes are rendering correctly, however some models are actually missing validation.