Commit Graph

2248 Commits

Author SHA1 Message Date
Doug Bunting 27e4822a7b Preserve `class` casing when merging a `TagBuilder` into a `TagHelperOutput`
- #5313

Also:
- preserve existing `TagHelperAttribute.ValueStyle`
 - fix this in `UrlResolutionTagHelper`, `LinkTagHelper`, and `ScriptTagHelper` as well
- correct handling of non-`string` `classAttribute.Value`s in `TagHelperOutputExtensions`
 - relates to #3918 because new `ClassAttributeHtmlContent` is smaller than any concatenated attribute value

nit: clean up `CacheTagHelper` whitespace and `using`s
2016-09-26 15:56:30 -07:00
Ajay Bhargav Baaskaran 0d782d9d9a Adding design time support for ViewComponent TagHelpers 2016-09-23 16:58:01 -07:00
Ryan Brandenburg 03b3d6bec8 Use DataAnnotationLocalizerProvider for Display localization 2016-09-23 10:05:42 -07:00
Kiran Challa 01f7ecd9d9 [Fixes #5154] Stream should be suppressed from model metadata validation 2016-09-19 11:10:03 -07:00
Ajay Bhargav Baaskaran 3c05d10430 Set designTime to false 2016-09-19 10:49:01 -07:00
Ajay Bhargav Baaskaran b3fe8b30ac Moved VCTHDFactory to .Internal namespace 2016-09-16 15:50:44 -07:00
Ajay Bhargav Baaskaran 5ad5f7a3f9 Addressed feedback 2016-09-16 11:01:51 -07:00
Ajay Bhargav Baaskaran 0cfd5363f8 Added ViewComponentTagHelperDescriptorResolver and related stuff 2016-09-15 17:12:43 -07:00
Pranav K 760c8f3867 Ensure Append writes to the right page after Clear 2016-09-14 18:57:21 -07:00
Ajay Bhargav Baaskaran 42027b6cc2 [Fixes #5243] Handle null values in TempData properly 2016-09-14 15:41:38 -07:00
Pranav K d9ff1d81d6 PagedBufferedTextWriter does not flush synchronous data prior to writing data asynchronously
Fixes #5241
2016-09-14 14:52:06 -07:00
Pranav K 43071319aa Buffer rendered CacheTagHelper content strings to a custom TextWriter
Fixes #4893
2016-09-14 14:47:37 -07:00
Pranav K a480378a44 Make AuthorizeFilter constructable
* Make AuthorizeFilter constructable

Fixes #5253
2016-09-14 13:43:56 -07:00
Pranav K 994835ce47 Remove IViewsProvider and make view lookup to the feature provider 2016-09-14 13:40:05 -07:00
Doug Bunting 809d2bf7ec Add `ValidationHtmlAttributeProvider` to make `AddValidationAttributes()` available
- #5028
- helpers similar to our HTML or tag helpers can use the new singleton to examine or add validation attributes
 - in the most common case, helpers add validation attributes to a `TagBuilder`
- separate `DefaultValidationHtmlAttributeProvider` from `DefaultHtmlGenerator`
 - avoids creating two instances of the `DefaultHtmlGenerator` singleton
 - would be even uglier to require callers to cast an `IHtmlGenerator` to `ValidationHtmlAttributeProvider`
- `[Obsolete]` old `DefaultHtmlGenerator` constructor
2016-09-13 21:07:18 -07:00
Pranav K 4a5e1f4a72 Use as cast instead of C-style cast for IVewContextAware helpers
Fixes #5254
2016-09-12 16:34:02 -07:00
Doug Bunting eee1a9fef4 Do not generate a validation summary when `excludePropertyErrors` unless specific model has an error
- #5209
- update affected `HtmlHelperValiationSummaryTest` and functional tests
- add `ValidationSummaryTagHelperTest` tests to cover related scenarios

##### Behaviour changes when no errors exist for the model:
###### Tag helper
``` html
<div asp-validation-summary="ModelOnly" class="order"><h3>Oopsie<h3></div>
```
previously generated
``` html
<div class="order validation-summary-errors"><h3>Oopsie</h3><ul><li style="display:none"></li>
</ul></div>
```
and now generates
``` html
<div class="order"><h3>Oopsie</h3></div>
```
###### HTML helper
``` c#
@Html.ValidationSummary(excludePropertyErrors: true, message: "Oopsie")
```
previously generated
``` html
<div class=\"validation-summary-errors\"><span>Oopsie</span>
<ul><li style=\"display:none\"></li>
</ul></div>
```
and now generates nothing (`@HtmlString.Empty`).
2016-09-08 15:36:47 -07:00
Ryan Brandenburg 43a0a5a9f1 Replace ConfigureOptions with IConfigureOptions 2016-09-08 15:19:07 -07:00
Ajay Bhargav Baaskaran 4677bf13fa Reverting accidental changes 2016-09-08 08:28:51 -07:00
Crystal Qian 05392cbf35 Added view component tag helper code generator. (#5195)
This addresses #1051. There is one more pull request that needs to be completed/merged (for `CompositeTagHelperDescriptorResolver` and friends). After that, runtime should work!
2016-09-07 20:30:09 -04:00
Ryan Brandenburg 830983a477 Fixes #5198 Stops caching of Enum display values (#5185)
Fixes #5197 GetEnumSelectList uses IStringLocalizer
Fixes #4215 Html.DisplayFor now checks DisplayAttributes on enums
2016-09-07 16:00:17 -07:00
Ajay Bhargav Baaskaran 21236cc98e [Fixes #5016] Perf: Check for OPTIONS before looking for CORS headers 2016-09-06 14:48:57 -07:00
Christian Weiss a5db01169a Fixed comment in Filters/FilterCollection (#5225) 2016-09-03 11:04:58 -07:00
Doug Bunting fae0e9a66e Handle `!ConvertEmptyStringToNull` cases correctly in `SimpleTypeModelBinder`
- #4988
- preserve whitespace as the setting demands
 - correct previous `string.IsNullOrEmpty()` call to match previous `ValueProviderResultExtensions.ConvertTo()` use
- short-circuit other `string`-to-`string` conversions (as `ValueProviderResultExtensions.ConvertTo()` does)
- correct documentation of `ConvertEmptyStringToNull` properties
- add more tests of these scenarios and remove duplicate `BindModel_ValidValueProviderResult_ConvertEmptyStringsToNull()` test
2016-09-02 16:15:18 -07:00
Christian Weiss 6016966dcf Typo in comment of MvcJsonMvcOptionsSetup (#5221) 2016-09-02 14:30:50 -07:00
Doug Bunting 2659904061 Build on be73cd7 to include `<input type="image"/>`, reduce duplication, and add tests
- consolidate `ButtonTagHelper` and `SubmitTagHelper` into `FormActionTagHelper`
- consolidate `ButtonTagHelperTest` and `SubmitTagHelperTest` into `FormActionTagHelperTest`

nits:
- do not allocate dictionaries in the `<a>` or `<form>` tag helpers unless needed
- clean up some hard-to-maintain whitespace
2016-09-01 20:03:13 -07:00
Shahriar Gholami be73cd77bf Add buttonTagHelper and submitTagHelper for formaction
Addresses #1668
2016-08-31 22:02:47 -07:00
Crystal Qian df81f8be57 Added a view component tag helper descriptor factory (#5189) 2016-08-31 17:31:04 -07:00
Doug Bunting 34a4c8c191 Add more tests covering `asp-format` use
- also add comments requested in PR #5109 and #5205
2016-08-31 12:34:22 -07:00
muhammed baykal 4bda1cbe6d Implemented asp-format support in input[type=hidden] tag helper. 2016-08-30 18:37:19 -07:00
Kiran Challa f7ee16170c [Fixes #5161] Support running middleware pipeline as part of a resource filter 2016-08-30 09:26:04 -07:00
Ajay Bhargav Baaskaran 499fefcc03 Added some missing docs 2016-08-26 16:35:44 -07:00
Ajay Bhargav Baaskaran a6a4b5369a [Fixes #5166] Support passing instance directly when invoking ViewComponents with single parameter 2016-08-26 16:33:42 -07:00
Ajay Bhargav Baaskaran 9ed753288f [Fixes #5170] Fixed KeyNotFoundException in UrlHelperFactory.GetUrlHelper() 2016-08-26 11:27:02 -07:00
Kiran Challa ece8f33a65 [Fixes #5175] Async resource filters' short circuited result getting executed more than once. 2016-08-25 16:30:41 -07:00
N. Taylor Mullen 7036e2b0f5 Change `ViewComponent.View()` to flow the `ViewData.Model`.
- This is more consistent with how controllers work.

#4882
2016-08-25 10:22:23 -07:00
Pranav K c942eab6e2 Adding support for Razor precompilation
Fixes #3917
2016-08-19 07:27:51 -07:00
N. Taylor Mullen 2f46113556 Merge branch 'rel/1.0.1' into dev 2016-08-17 14:34:15 -07:00
N. Taylor Mullen edb5baf81c Change SHA256 algorithm to work on FIPS-compliant machines.
#5103
2016-08-17 14:25:22 -07:00
N. Taylor Mullen 6e5fd4f89f Up Antiforgery to 1.0.1 for FIPS compliance changes. 2016-08-17 14:25:19 -07:00
Ryan Brandenburg 889af50318 Localize DataAnnotations (#5129) 2016-08-16 11:52:15 -07:00
Ajay Bhargav Baaskaran 8de4ddc010 Logging Info instead of Warning for Authorization failure in ControllerActionInvoker 2016-08-16 10:20:54 -07:00
Kiran Challa a4ec3bb24a [Fixes #4991] Misleading MissingMethodException message for incorrect routes 2016-08-11 11:57:21 -07:00
Kiran Challa 936f5a4f6a Made HttpMethod match case-INsensitive
Related to https://github.com/aspnet/CORS/issues/77
2016-08-08 14:34:27 -07:00
ivano 6e5187c1ae Using new StringRouteConstraint for area constraint 2016-08-08 08:47:04 -07:00
N. Taylor Mullen 663f6a1718 Expose `GetInputType` as a protected member of `InputTagHelper`.
- Added doc comments.

#4979
2016-08-04 15:13:29 -07:00
Kiran Challa ac98417398 ModelBinding: Remove IsReadOnly checks and add/update tests 2016-08-04 14:20:23 -07:00
ivano scifoni be5deef584 Created option for RequireHttpsAttribute.Permanent
Fixes #4650
2016-08-04 11:43:16 -07:00
jacalvar b56cab6414 Merge branch 'rel/1.0.1' into dev 2016-08-01 14:16:58 -07:00
jacalvar f0732e9e21 [Fixes #5038] HTTP Verbs mapping error GET and DELETE
When an action contained an attribute derived from HttpMethodAttribute,
doesn't specify an attribute route and there is also another attribute
extending HttpMethodAttribute that has a route defined on it; we ignored
the HttpMethodAttribute attribute without a defined route when building
the set of action selectors for the method.

This caused the resulting action to be unbounded and to accept requests
for other verbs not associated with it. The root cause of the problem was
that attributes override equality and do a field by field comparison but
ignore fields in the base classes of the type, so if an attribute is part
of a class hierarchy (like Http*Attributes) there might be two different
attributes that get considered equal.

The fix for the problem has been to change using Contains on a couple of
collections (that uses the equals method on the underlying object) and
check for the existence of the attribute on the collection directly by
using reference equality.
2016-08-01 12:49:23 -07:00
Ryan Nowak e77dc3af6a Implement manual state machine 2016-08-01 10:38:46 -07:00
N. Taylor Mullen d60ed06c19 Add link tag attributes to generated fallback tags.
- Updated functional tests and link tag script to include modified extra attributes content.

#4084
2016-07-29 16:30:56 -07:00
Kristian Hellang 8d1e419a99 Added ObsoleteAttribute to unused ViewEngine property
Fixes #5066
2016-07-29 15:19:43 -07:00
Ryan Brandenburg 27a641f4bf Only create filters for models that need them (#5044) 2016-07-27 16:36:26 -07:00
jacalvar 7a3f24d49d [Fixes #4960] Action results returned from controller actions rendered as json instead of executed 2016-07-27 14:42:46 -07:00
Derek f3f2bcdbb5 Update comments to reflect the correct default values for HtmlDateRenderingMode (#4997) 2016-07-27 13:20:12 -07:00
BrennanConroy 0a5f8e013e AppDomain safety 2016-07-27 09:26:06 -07:00
Ryan Nowak 855974f128 Fix #4959 - Doc cleanup for RouteValueAttribute 2016-07-27 08:59:34 -07:00
Pranav K 5092e75387 Pin repo version to 1.0.1 2016-07-26 12:09:57 -07:00
Doug Bunting 49a48a0a33 Mark `ValueProviderResultExtensions` as `[Obsolete]`
- #4521
2016-07-22 12:39:13 -07:00
Ryan Nowak 85ca3e4976 Fix #4998 - Change lifetime of ViewComponentResultExecutor
This service has a scoped dependency so it should be scoped or transient.
2016-07-21 10:23:36 -07:00
Ryan Nowak fb514d7ef8 Update versions to 1.0.1-*
Also adding a version number to TestConfiguration. This is not a leaf node
so it should have a version.
2016-07-21 09:55:28 -07:00
Ryan Nowak bc76c0ef31 Fix #4998 - Resolve IViewComponentHelper every time
This change resolves the scoped IViewComponentHelper every time its
needed, rather than misusing a shared instance. IViewComponentHelper is
stateful, so sharing an instance was the cause of this bug.
2016-07-20 17:01:39 -07:00
Doug Bunting 8a6e99c7c0 Always render antiforgery tokens if `!CanRenderAtEndOfForm`
- #5005
- also add `FormContext` doc comments
2016-07-20 15:25:08 -07:00
ivano scifoni 581a5ea573 column attribute for <textarea> is incorrect (#5049)
- Modify tagBuilder.MergeAttribute key to cols
2016-07-20 09:22:39 -07:00
Doug Bunting 35cc5b6e83 Use `IValidationAttributeAdapterProvider` more often
- #5009
- don't create a `RequiredAttributeAdapter` directly
2016-07-19 15:35:08 -07:00
mnltejaswini 0240882031 Perf: Use RouteValueDictionary in AnchorTagHelper rather than creating a new Dictionary (#4941)
* Perf: Use lighter, more optimized dictionaries for route sensitive TagHelpers

* Changing the project dependency to Routing.Abstractions
2016-07-18 18:41:41 -07:00
Kiran Challa 52a7c112e8 [Fixes #4876] ContentResult forcing chunked encoding 2016-07-18 16:10:01 -07:00
Doug Bunting e5cb6f9595 Add `null` check for `ModelStateEntry.Children`
- #4989
2016-07-18 14:02:17 -07:00
Kiran Challa 26b3b5ea7b [Fixes #4766] Remove disable buffering feature from our action result classes 2016-07-18 13:07:54 -07:00
Doug Bunting 52e4ca7232 Put `ModelBindingHelper` on a diet
- remove extra argument checks
- remove two test-only `ConvertTo()` overloads
 - this relates to #4521
2016-07-15 11:53:32 -07:00
Pranav K b7a0393311 Register DependencyContextRazorViewEngineOptionsSetup after RazorViewEngineOptionsSetup
Fixes #4902
2016-07-15 10:33:59 -07:00
Ryan Brandenburg 8ec27958e7 Replace Linq in hotpath (#5024) 2016-07-15 10:19:17 -07:00
Ryan Brandenburg 310ab25347 Make tests resilient to Localization (#5011) 2016-07-14 09:28:01 -07:00
ivano scifoni b4677a44da #4847 Fix MapAreaRoute override existing area constraint (#4954)
*  #4847 Fix MapAreaRoute override existing area constraint
Modify Test project
Modify web test routing

* wrong field tested

* IntRouteConstraint expected

* Default for area route on Travel area

* Removed commented code
simplify constraintsDictionary area assign
renamed test method

* test name

* renamedd test to MapAreaRoute_DoesNotReplaceValuesForAreaIfAlreadyPresentInConstraintsOrDefaults
2016-07-11 10:53:33 -07:00
ivano scifoni 3d2bb673ee Add IMvcCoreBuilder.AddJsonOptions extension method
Fixes #4967
2016-07-08 09:00:59 -07:00
Doug Bunting 7430efa8cc One build to rule them all
- well, at least VS and command-line builds will share output
- part of aspnet/Coherence-Signed#277
2016-07-06 16:21:18 -07:00
Pranav K 7ce344270a Show message about preserveCompilationContext when a Roslyn diagnostic error says a reference
could not be found.

Fixes #4911
2016-07-06 15:09:54 -07:00
Ryan Nowak 3ed0d01eae Fix #4929 - Move IActionInvokerFactory from .Internal
Also added a wealth of doc comments to an area that's not currently super
well documented.
2016-07-05 13:18:34 -07:00
Doug Bunting 15f25d569a Improve `IUrlHelper` and related doc comments
- #4245, #4507
2016-07-05 09:34:33 -07:00
Doug Bunting 42cea41737 Fail more gracefully when option collections cleared
- #4690
- move `ModelBindingMessageProvider` init from `DefaultBindingMetadataProvider` to `DefaultModelMetadata`
 - in addition to avoiding error cases, this removes some boilerplate
- add specific errors to `BodyModelBinderProvider`, `CompilerCache`, `CompositeViewEngine`, `ModelBinderFactory`,
  and `ObjectResultExecutor`
 - `DefaultRazorViewEngineFileProviderAccessor.FileProvider` now a `NullFileProvider` in empty case
2016-06-30 14:52:50 -07:00
Medeni Baykal a852352223 Fix for https://github.com/aspnet/Mvc/issues/4903. (#4907)
Fix for https://github.com/aspnet/Mvc/issues/4903.
- `HtmlHelperTextAreaTest` added
- fix up `HtmlHelperTextBoxTest`
2016-06-29 10:11:54 -07:00
Crystal Qian e51a118a9d Added consistent model property to view result variants (#4901)
* Added consistent model property/tests to ViewResult, PartialViewResult, ViewComponentResult. This resolves #4813.

* Removed unnecessary model asserts

* Removed redundant model checking
2016-06-28 09:38:37 -07:00
Pranav K a1f4786695 Updating json files to pin versions and build files to pin KoreBuild 2016-06-27 13:51:10 -07:00
Crystal Qian c319ae51a5 Changed min/max parameter order in StringLengthAttributeAdapter (#4899)
Changed min/max parameter order in StringLengthAttributeAdapter. This fixes #4864.
2016-06-27 10:21:50 -07:00
Pranav K 72dbda8804 Update to 1.0.1 version 2016-06-24 09:40:03 -07:00
Crystal Qian dad6374258 Revert "Changed min/max parameter order in StringLengthAttributeAdapter"
This reverts commit d19765802b.
2016-06-22 15:34:53 -07:00
Crystal Qian d19765802b Changed min/max parameter order in StringLengthAttributeAdapter 2016-06-22 15:33:33 -07:00
Shahriar Gholami 94fa34ca41 TempData convenience property added to ViewComponent (#4873)
* TempData convenience property added to ViewComponent

 #4728

* PR feedback
2016-06-17 10:15:50 -07:00
Pranav K cd7954a164 Updating to dev versions 2016-06-16 10:40:11 -07:00
jacalvar 70af8cf79e Update Json.NET to 9.0.1 2016-06-15 15:11:56 -07:00
Doug Bunting b5a6303bb6 Address more PR comments 2016-06-10 14:49:49 -07:00
Doug Bunting 3a6541af10 Address PR comments 2016-06-10 14:26:14 -07:00
Doug Bunting 1f6bbf9967 Add doc comments for `public` attributes
- #4641
2016-06-10 14:26:14 -07:00
Kiran Challa a2feeab545 Changed the form tag helpers execution order to be more explicit.
[Fixes #4824] Fix Travis failure for test Microsoft.AspNetCore.Mvc.FunctionalTests.TagHelpersTest.ReregisteringAntiforgeryTokenInsideFormTagHelper_DoesNotAddDuplicateAntiforgeryTokenFields
2016-06-10 11:27:48 -07:00
Pranav Krishnamoorthy 55e9adf84d Generate portable pdbs in coreclr 2016-06-09 17:12:24 -07:00
Ryan Brandenburg 5339a3e0ce Add ExceptionHandled to ExceptionContext (#4825) 2016-06-09 15:22:11 -07:00
Pranav K 8c8fd6446b Use regular PDBs on full desktop when possible
Add a test to verify exceptions thrown from views is pretty printed by diagnostics middleware

Fixes https://github.com/aspnet/Diagnostics/issues/293
Fixes #4737
2016-06-09 14:59:38 -07:00
Ryan Nowak a8142b8858 Fix #4614 - update IModelBinder docs 2016-06-09 14:21:07 -07:00
Kiran Challa f1982bd987 Suppress default status code response type in api descriptions when explicit response types have been provided
[Fixes #4823] How to override the default (200) status code with ProducesResponseType
2016-06-09 12:07:52 -07:00