Commit Graph

21 Commits

Author SHA1 Message Date
Doug Bunting a5600a74a3 Calculate `ModelMetadata.DataTypeName` based on metadata
- helps MVC helpers like `@Html.EditorFor()` select the correct template
- #933

nit: add XML doc for `DataTypeName` in base `ModelMetadata`
2014-10-02 19:13:35 -07:00
dougbu 4351ddd092 Add `ModelMetadata.HasNonDefaultEditFormat` property
- add `DataType` property to `CachedDataAnnotationsMetadataAttributes` in support of `ComputeHasNonDefaultEditFormat()`
- provide doc comments and flesh out the implementation of `DisplayFormatString` and `EditFormatString`

nits:
- add comment about _not_ overriding `ComputeIsComplexType()` in `CachedDataAnnotationsModelMetadata`
- restore alphabetic order in `CachedDataAnnotationsMetadataAttributes`
- seal `SimpleDisplayText` in `CachedModelMetadata<TPrototypeCache>`, matching MVC 5.2
2014-08-20 10:07:36 -07:00
dougbu c0179f74cc Do not repeatedly evaluate `ModelMetadata.Properties` enumeration
- supports useful property updates of `ModelMetadata` instances in the collection
- provide a controllable ordering using the `Order` value
- part of #964
2014-08-15 12:33:22 -07:00
dougbu 796ff1d3d3 Add `HideSurroundingHtml` property to `ModelMetadata`
- #843
- add property as well as the related `[HiddenInput]` attribute
- use this property to address some TODOs in default display and editor templates
2014-08-15 10:50:17 -07:00
dougbu 8ab11bc073 Correct XML comment syntax
- fix problems at least with Roslyn compiler and VS IntelliSense or the Object Browser
 - `<see langref="keyword"/>` generates nothing
 - `<example>` at top level (outside `<summary>`) generates nothing
 - curly braces don't become angle brackets outside `<see cref="reference"/>` references
  - yeah, a point @yishaigalatzer asked about in a previous PR
- `<see href="reference"/>` is not valid
- correct some invalid use of angle brackets and remove useless empty elements
- correct unresolved XML comment references; generally, add namespace prefix

Symptoms for some of the above issues included
- generated XML comments such as `<!-- Badly formed XML comment ... -->`, usually indicating an unclosed element
- generated XML attributes such as `cref="!:..."`, indicating a broken reference
 - in a couple of cases we had `<typeparamref cref="TOption"/>`; attribute should be `"name"`

Few wording changes beyond
- `"opening </form> tag"` -> `"<form> start tag"`
- `"closing </form> tag"` -> `"</form> end tag"`

Also correct two typos in `HtmlHelper`

Will create a unit test to ensure XML syntax doesn't degrade going forward.  Separate PR.
- for now, check using `dir -r *.xml | sls '!'`
2014-08-05 14:24:48 -07:00
dougbu 48085eea08 Correct `ModelMetadata.IsRequired` to honour overrides
- subclasses would not calculate a value because `ModelMetadata` constructor
  set this property
- meant presence of a `[Required]` attribute in the model was ignored
2014-07-24 18:32:13 -07:00
dougbu 80a27c6f3b Add `ModelMetadata.DisplayName` property
- value comes from `Name` property of `[Display]` attribute
- use new property in `@Html.DisplayName()` and `@Html.Label()`; remove associated TODO comments
2014-07-24 18:31:48 -07:00
dougbu f4b582f654 Remove incorrect override of `ModelMetadata.GetDisplayName()`
- this method delegates to a number of `ModelMetadata` properties
- no use cases for overriding; should not be `virtual`
- `ModelMetadata.DisplayName` override using `DisplayAttribute.GetName()` coming in next commit
2014-07-24 16:49:02 -07:00
Pranav K 24e1ac7ca1 Revive ModelMetadata.ShowForDisplay and ModelMetadata.ShowForEdit
Fixes #679
2014-06-23 16:50:09 -07:00
Pranav K 7396f58d99 Support ModelMetaData.IsRequired
* Update DataAnnotationsModelValidatorProvider to use ModelMetadata.IsRequired
* Adding tests and updating existing ones that didn't work with IsRequired

Fixes #533
2014-06-10 10:20:24 -07:00
Pranav K cc0dadc6b6 More Stylecop cleanup for ModelBinding and Razor 2014-06-09 14:27:12 -07:00
Pranav K 97e06138ed Cleaning up StyleCop errors 2014-06-04 13:28:30 -07:00
Andrew Peters f13865dedc Updating copyright headers 2014-05-08 23:01:20 -07:00
anpete 8208cd6b2f Update file headers 2014-05-01 17:42:33 -07:00
sornaks d63d998e95 Introducing DisplayText, DisplayTextFor, Id, IdFor, IdForModel.
Fixing CachedDataAnnotationsModelMetadata to support NullDisplayText.
2014-04-30 10:23:25 -07:00
Pranav K cc00d8cff7 Modify TypeConverterModelBinder to use ValueProviderResult.CanConvertFromString to determine if it can convert a
value

* Adding support for extra type conversions
2014-04-22 23:00:58 -07:00
N. Taylor Mullen 5da827b58f Add infrastructure for templated display helpers.
I changed code paths for how we render templates from the old world to better separate code.
2014-04-06 15:53:30 -07:00
N. Taylor Mullen dad87c5239 Add ValidationSummary helper.
This enables Html.ValidationSummary.  This is in reference to WEBFX-97.
2014-04-02 14:58:08 -07:00
Pranav K a2cea18529 Replacing argument not null checks in ModelBinding with NotNullAttribute
* Removing not null guard tests in ModelBinding
2014-03-25 12:35:33 -07:00
Pranav K 04c7b50726 Removing IsFromBody property from ModelMetadata 2014-02-26 13:40:35 -08:00
Pranav K b6c78de4ea Reintroduce model binding 2014-02-23 15:23:58 -08:00