Commit Graph

448 Commits

Author SHA1 Message Date
Ryan Nowak df8f84b772 Fix #1287 - Port WebAPI parameter binding behavior
This change modifies the default parameter binding behavior for an
ApiController to use the WebAPI rules.

'simple types' default to use route data or query string
'complex types' default to use the body (formatters)

Adds ModelBindingAttribute to enabled model binding
2014-10-17 16:51:48 -07:00
sornaks 5b1bcb6079 Issue #1214: Cannot pass a int parameter to the views from ViewComponent.
Fix: Checking if the model is not null in the Copy constructor of ViewDataDictionary.
2014-10-17 16:40:25 -07:00
Harsh Gupta 75405e3b76 Adding support for bind attribute. 2014-10-17 16:24:28 -07:00
Doug Bunting dd5da33a62 Sanitize "id" attributes for HTML 4.0.1
- #704 part 2 of 2
- change `@Html.Id()` to sanitize return value; was identical to `@Html.Name()`

Copied `TagBuilder.CreateSanitizedId()` and `TagBuilder.Html401IdUtil` from MVC 5.2
- except this `CreateSanitizedId()` returns a valid identifier if first `char` is not a letter
 - e.g. "[0].Name"

nits:
- expand variable names, use lots of `var`, put `public` members first
- add doc comments for `CreateSanitizedId()`

Note users will be able to apply different sanitization once we fix #1188.
2014-10-17 16:12:45 -07:00
jacalvar 98d749d03c [Fixes #1389] Can't bind complex type data from route parameters.
Changed DictionaryBasedValueProvider to do a prefix check instead of just checking if the underlying
dictionary contains the key.
2014-10-17 15:32:21 -07:00
Pranav K 66f626b828 Remove unnecessary references from project.json 2014-10-17 14:26:58 -07:00
Pranav K 5119d16b64 ViewComponent.Invoke() should be able to invoke views
Fixes #285
2014-10-17 12:23:18 -07:00
Pranav K b8d30f29c6 Add IsPartial property to IRazorPage
Fixes #1002
2014-10-17 10:52:39 -07:00
Doug Bunting 012e03e5d0 Add `InputTagHelper`
- also make `TagHelperOutputExtensions.MergeAttributes()` case-insensitive

nits:
- deliniate attribute names in all resource strings
- update validation messages in TagHelperSample.Web
2014-10-16 23:34:10 -07:00
N. Taylor Mullen f8f08f0903 Fix tests and changed TagHelper activates property accessors.
- Changed TagHelper property accessors from private to protected internal.
- Changed throw tests to be shorter.
- Changed reflection setting to now use the internal accessibility of the TagHelpers
- Removed activator to just use internal accessibility of TagHelpers.
- Changed new StringWriter() instances where we didn't need the StringWriter to be TextWriter.Null
2014-10-16 22:39:44 -07:00
N. Taylor Mullen f8b0249918 Add Label TagHelper.
- Validated label TagHelper functionality.

#1249
2014-10-16 21:13:08 -07:00
NTaylorMullen 9c07055ac7 Add ValidationSummaryTagHelper.
- Tested ValidationSummaryTagHelper behavior.
- Updated sample to utilize new ValidationSummaryTagHelper format.

#1251
2014-10-16 21:13:05 -07:00
NTaylorMullen 2729cdc9b7 Add ValidationMessageTagHelper.
- Added tests to validate ValidationMessageTagHelper functionality.

#1250
2014-10-16 21:12:53 -07:00
NTaylorMullen 57d1c542db Add AnchorTagHelper.
- Added a TagHelper that targets the <a> tag and allows users to do the equivalent of Html.ActionLink or Html.RouteLink.
- Added tests to validate AnchorTagHelper functionality.

#1247
2014-10-16 21:12:49 -07:00
N. Taylor Mullen 4c98c8fcb9 Add FormTagHelper.
- Added the FormTagHelper.
- Utilized the IHtmlGenerator to share base functionality with the HTMLHelper counterparts.
- Added tests to validate FormTagHelper functionality.

#1246
2014-10-16 21:12:46 -07:00
N. Taylor Mullen 63f8f7de6d Add extensions for TagHelperOutput to copy and merge from TagBuilder.
- Added tests to validate functionality of all TagHelperOutputExtension methods.

#1319
2014-10-16 21:12:42 -07:00
NTaylorMullen 20cc294c70 Reacted to options and hosting changes after rebase. 2014-10-16 21:12:38 -07:00
Doug Bunting 3b7b0f867d Update `HtmlHelper` to use `IHtmlGenerator`
- make a few more methods available as `internal static` in `DefaultHtmlGenerator`
 - remove `IHtmlGenerator.GenerateOption()`; now `internal static`

nits:
- add `IHtmlGenerator.IdAttributeDotReplacement`
- move `DefaultHtmlGenerator.IdAttributeDotReplacement` after constructor
- move `HtmlHelper.ActionLink()` below static methods
- move newly-`internal` methods together in `DefaultHtmlGenerator`
- correct placement of `DefaultHtmlGenerator.GetValidationAttributes()` comment
2014-10-16 21:12:34 -07:00
Doug Bunting ba8b3d14a4 Add tests of `TextAreaTagHelper`
- new Microsoft.AspNet.Mvc.TagHelpers.Test project
- bit of test infrastructure -- `TestableHtmlGenerator`
 - short-curcuits validation attribute and AntiForgery additions
 - should help when testing all MVC tag helpers
2014-10-16 21:09:11 -07:00
Ryan Nowak 9fadcf74ca Fix for item #1278 - Add WebAPI ActionResult types and helper methods on
ApiController

Ports all of the WebAPI action result types.
2014-10-16 19:33:49 -07:00
jacalvar 8966680075 [Fixes #1332] Port IContentNegotiator to WebAPI shim for CoreCLR support
1. Ported IContentNegotiator.
2. Enabled Core CLR configuration
2014-10-16 17:22:47 -07:00
sornaks 53379e4395 Issue #1206 - DefaultBodyModelValidator throws if get accessor throws.
Fix: The MvcOptions takes in a list of ExcludeFromValidationDelegate (Func<Type,bool>). This func verifies if the type is excluded in validation or not.
2014-10-16 16:09:30 -07:00
Doug Bunting 34f17db94c Add `DefaultEditorTemplates.MultilineTemplate`
- #965
- test call-throughs from `Html.Editor[For]()` to inner `IHtmlHelper`
 - add another parameter to `DefaultTemplatesUtilities.GetHtmlHelper()`

nit: reorder dictionaries at the top of `TemplateRenderer` slightly
2014-10-16 15:14:12 -07:00
Stephen Halter a21ed4bc51 Replace calls to GetService<T> with GetRequiredService<T>
Even though GetService<T> still exists, GetRequiredService<T> preserves
the old behavior of throwing for missing services.
2014-10-16 14:51:41 -07:00
Stephen Halter 54ac14fa0f IServiceProvider.GetService now returns null for missing services
Previously GetService would throw if the requested service was missing.
This commit updates MVC to account for the change in behavior.
2014-10-16 14:51:34 -07:00
jacalvar f8035d6b04 [Fixes #1201] Handle virtual paths in FilePathResult 2014-10-16 13:05:55 -07:00
Harsh Gupta 8f933b2ac3 [Fixefor #860]- Adding Support for [FromFormData] [FromQuery] and [FromRoute],
also updates FromBody to use the new pattern for model binding.
2014-10-16 10:20:15 -07:00
Pranav K b2a01e7b45 Adding support for inheriting tag helpers from _ViewStart files
Fixes #1166
2014-10-16 07:55:37 -07:00
Pranav K 0ad959e236 DateTimeOffset doesn't have a TypeConverter in Mono 2014-10-16 07:10:35 -07:00
Kiran Challa acb2a99e9f [Fixes #1283] Add functional tests for WebAPI-style controllers returning HttpContent 2014-10-16 01:52:33 -07:00
Pranav K 75c6327b2e Layout property needs to be propogated between nested view starts
Fixes #1364
2014-10-15 18:54:02 -07:00
Pranav K de77c92a0a Reviving PartialViewResult and associated methods on Controller
Fixes #824
2014-10-15 18:28:08 -07:00
Ryan Nowak 7666d5973f fix build issue in coreclr 2014-10-15 17:32:06 -07:00
Ryan Nowak 5f47546d40 Use DefaultOrder in MvcOptionsSetup 2014-10-15 17:12:52 -07:00
Pranav K 44d888c319 ViewStartUtility should not return current path if current is a view start
file
2014-10-15 15:05:27 -07:00
sornaks 2c4b3dd3fc Issue #937: Adding functional tests for Filters. 2014-10-15 14:24:53 -07:00
Kiran Challa e985c22528 [Fixes #1216] Provide a property on JsonOutputFormatter to set serializer settings
[Fixes #1221] Rename OutputFormatter's WriteResponseContentHeaders to WriteResponseHeaders
[Fixes #932] Setting Json Serializer Settings
2014-10-15 09:27:09 -07:00
Harsh Gupta ebf64ce4e3 Adding HttpResponseException to WebApi Shim. 2014-10-15 09:07:40 -07:00
Hao Kung 448ac5a0dc React to options and hosting changes 2014-10-14 19:20:28 -07:00
jacalvar 1680616fe5 [Issue #1133] RedirectToActionResult and UrlHelper should use HostString, PathString, etc. To build Urls.
Added tests to describe the current behaviour with Unicode hosts.
2014-10-14 16:12:29 -07:00
sornaks 5fa8a91111 -Issue #913 - Model-binding is being case-sensitive when binding Url data to Enum parameter.
Fix: Using TypeConverter solves this problem.
-Issue #1123 - TypeConverterModelBinder cannot bind "byte" and "short".
Fix: Modified code to use TypeConverter which can handle these scenarios.
-Removing the GetConverterDelegate method and making the code similar to the WebApi.
2014-10-14 15:36:52 -07:00
Pranav K a41b9dc983 Add Html.Partial - sync versions of Html.PartialAsync
Fixes #1107
2014-10-14 15:15:50 -07:00
Pranav K d9ebb37906 Removing Microsoft.AspNet.Mvc dependency from ModelBinding 2014-10-14 12:22:29 -07:00
SonjaKhan 0f5bbdf417 updating ILogger, see aspnet/Logging#3 2014-10-14 10:25:01 -07:00
Kiran Challa dd587f743b [Fixes #1331] Dispose HttpResponseMessage once its written out in HttpResponseMessageOutputFormatter 2014-10-13 22:34:36 -07:00
Pranav K 4ec6da1ed3 Adding RenderSectionAsync to RazorPage
Fixes #845
2014-10-13 17:44:49 -07:00
jacalvar 39376617cc [Fixes #809] Multiple [Http*] verbs should create multiple actions 2014-10-13 15:25:53 -07:00
jacalvar 3f54492930 [Fixes #885] API Explorer: Link Generation
1) Expose the simplified relative path template by cleaning up constraints, optional and catch all tokens from the template.
2) Expose the parameters on the route template as API parameters.
3) Combine parameters from the route and the action descriptor when the parameter doesn't come from the body. #886 will refine this.
4) Expose optionality and constraints for path parameters. Open question: Should we explicitly expose IsCatchAll?
2014-10-13 15:20:38 -07:00
Pranav K a633ef4f97 Modify Razor components to use RazorViewEngineOptions.FileSystem
Fixes #1302
2014-10-13 14:34:31 -07:00
YishaiGalatzer 4166c8cbc9 Fix unit test 2014-10-13 10:13:32 -07:00