Commit Graph

604 Commits

Author SHA1 Message Date
N. Taylor Mullen 5dbd006165 Add sample for Display Html Helper.
Showcased a lot of the core pieces of Display in the sample.  Some pieces are still missing such as DataType handling.  The infrastructure is there to handle it in the TemplateRenderer but the model metadata providers do not construct the metadata with the data types.
2014-04-06 15:56:08 -07:00
N. Taylor Mullen 8477f47632 Implement Display HTMLHelper.
Essentially add extension methods and call through to infrastructure.
2014-04-06 15:55:11 -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
Pranav K fc01cf6eea Fixing typo in DefaultAssemblyControllerProvider 2014-04-04 16:29:16 -07:00
Yishai Galatzer 1921387b56 Fix #198 2014-04-03 17:29:37 -07:00
Pranav K 9291cbc50b Adding support for RenderSection
* Adding unit tests for DefineSection \ RenderSection
* Changes per code review feedback
2014-04-03 15:00:06 -07:00
Pranav K df9d5c4875 Adding support for Render Section
Initial draft for DefineSection \ RenderSection. This change is based on
changes to the Razor parser to enable Razor to generate HelperResults for
section instead of void delegates.
2014-04-03 14:26:54 -07:00
Pranav K 75dae948b2 Change IViewEngine.FindView to be synchronous 2014-04-03 14:20:39 -07:00
Pranav K 2e0bed750e Adding support for Url.Content, Href and ~/ in Razor views 2014-04-03 14:12:55 -07:00
Ryan Nowak 49de9d2828 Adding Value Html Helpers 2014-04-03 12:22:03 -07:00
dougbu 42561f14d3 Quick fix for a build warning
- remove a duplicate using of `System.Collections.Generic`
- FYI `k build` command does not detect this problem
- nit: also cleanup long lines and align wrapped parameters
2014-04-03 09:38:14 -07:00
Yishai Galatzer ebd54bfc06 Dispose controllers after they have been utilized by the action invoker 2014-04-03 09:31:23 -07:00
dougbu 0a62a581de Add `TextBox` and `TextBoxFor`
- HtmlHelper service now needs an `IModelMetadataProvider` instance
- make `GetInputTypeString()` private
- use `TextBox()` and `TextBoxFor()` in MVC sample
- throw if `ExpressionMetadataProvider.FromLambdaExpression()` returns `null`
2014-04-02 20:49:48 -07:00
dougbu a1a180d4d0 Fill out Rendering.Expressions II
Copy from:
- some `static` `ModelMetadata` methods -> `ExpressionMetadataProvider`
- `TryGetValueDelegate` -> `TryGetValueDelegate`
- `TypeHelpers.CreateTryGetValueDelegate()`, related bits -> `TryGetValueProvider`
- `ViewDataDictionary.ViewDataEvaluator` inner class -> `ViewDataEvaluator`
- `ViewDataInfo` -> `ViewDataInfo`
- `ViewDataDictionary.Eval()`, related bits -> add to `ViewDataDictionary`

Change to fit in new world:
- usual stuff: `var`, `[NotNull]`, String -> string, namespaces, etc.
- PropertyDescriptor -> PropertyInfo
- update Reflection use
- no `IModelMetadata.Container` property
- improve a couple of variable and parameter names
- make `ViewDataInfo` immutable
- make `ViewDataDictionary.FormatValueInternal` `public` and -> `FormatValue`
- remove `[SuppressMessage]` attributes
2014-04-02 20:02:36 -07:00
Ryan Nowak 87c2041a52 Removing a dangling project from the sln 2014-04-02 19:32:30 -07:00
Yishai Galatzer d081300185 Factor filters action to private methods 2014-04-02 18:51:50 -07:00
Yishai Galatzer 9756f74565 Action invocation changes:
Changed 404s to throw
Propagate reflected exception
Add resources for specific errors
2014-04-02 18:51:49 -07:00
Ryan Nowak 1b4754454b Relayering MVC Dependencies Part 1/N
Merging Mvc.Razor.Host into Mvc.Razor
2014-04-02 18:28:34 -07:00
dougbu 7a97b13c8c Cleanup pass in Rendering (and Common)
- correct `ArgumentNullOrEmpty` and pass parameter name to
  `ArgumentException` constructor
- remove `[SuppressMessage]` attributes
- `AnonymousObjectToHtmlAttributes` should return an `IDictionary`
- `var`
- remove straggling copyright notices
- wrap long lines (did not reword any comments)
- align a few parameters
2014-04-02 14:59:35 -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
Yishai Galatzer b9010072aa Fix github #164 (when return type is object we always return 204) 2014-03-31 18:59:19 -07:00
dougbu fbbc59b392 Add `Name()`, `NameFor()`, and `NameForModel()` helper methods
- `Name()` is a `virtual` instance method to allow useful derivation
- `NameFor()` is an instance method to avoid adding `GetExpressionName()`
  to the public surface; either method could be `virtual`
- `NameForModel()` is an extension method because it's not usefully overridden
- use `Name*()` in sample
2014-03-31 16:07:56 -07:00
dougbu aaa30591a8 Get things working in our world
- usual stuff, especially use of `var` and `[NotNull]`
- remove references to `ExpressionFingerprintChain` and so on to minimize
  classes we bring over now (and remove one cache)
- copy over missing resource
- rework checks in `IsSingleArgumentIndexer()`
2014-03-31 15:31:40 -07:00
dougbu f108315038 Copy over two expression-support classes from legacy MVC 2014-03-31 15:31:39 -07:00
Sornakumar e8a76cfd7f Merge pull request #151 from sornaks/WebFX153
WebFX-153: Add Content() and Json() to the Controller class.
2014-03-31 15:03:56 -07:00
harshgMSFT 8d4a6c760a Action Selection Convention: Changes for Treating Index method as a default Get/Post method.
Also adds unit tests for the changes.
2014-03-31 12:59:30 -07:00
Pranav K c72c80c101 Add the ability to correctly determine if a particular field has been validated.
There are several portions of model validation that attempt to avoid
revalidating if a field has been validated. However the behavior of
ModelStateDictionary makes it difficult to distinguish between an
unvalidated field and a field without validation errors. This change
resolves this issue by letting the caller distinguish between the two
cases.
2014-03-31 12:40:38 -07:00
N. Taylor Mullen 2de5d57348 Add PartialAsync and RenderPartialAsync.
This enables Html.PartialAsync and Html.RenderPartialAsync.  It also includes a sample to showcase the features.  This is in reference to WEBFX-95.
2014-03-31 12:19:10 -07:00
N. Taylor Mullen a5ed1157d5 Refactor ViewEngine to support partials.
This references WEBFX-95 and is the preliminary part to support Partial helpers.
2014-03-30 17:20:09 -07:00
dougbu 2b70156cf4 Inject `HtmlHelper` property into `RazorView<T>`
- add `IHtmlHelper<T>` and `ICanHasViewContext`
- adjust `HtmlHelper` and `HtmlHelper<T>` to match
- throw if `ViewContext` accessed prior to `Contextualize` call
- XML comments (from old world) all around

Note
- no current need for an `HtmlHelper` copy constructor or `Clone()` method
- expect recursion code to get another injected `IHtmlHelper<T>` and then
  "contextualize" that instance with a new `ViewContext`
2014-03-28 17:29:00 -07:00
dougbu 94db3c392a Add `FormContext` to `ViewContext`
- start with `FormContext` and classes it needs from legacy world
- FYI `ModelClientValidationRule` came from Web Pages; the rest from MVC

Cleanup and make files compile in new world
- remove `FormContext.GetJsonValidationMetadata` method; will file an
  issue to revive this using Json.NET
- don't store `FormContext` in the `HttpContext`, no longer have child
  actions
- do `null` checks in setters, not getters (minor perf improvement)
- fix namespaces and usings
- wrap long lines; use `[NotNull]`; no copyright notice
- use explicit comparers for dictionaries
- add XML comment for odd `ModelClientValidationRule.ValidationType`
  property
- Collection -> List
2014-03-28 17:01:23 -07:00
Yishai Galatzer 54c73e4227 Cleanup + TODO 2014-03-28 16:55:56 -07:00
Pranav K f1efbde29d Revive HelperResult to allow using @helper in views 2014-03-28 11:08:15 -07:00
dougbu 655b329dd0 Increment System.Threading.Tasks package version
- today's build break, mark II

also remove dangling reference to TestCommon
2014-03-27 19:56:27 -07:00
dougbu f60f14d537 Add `TemplateInfo` property to `ViewDataDictionary`
Compared to legacy MVC:
- correct usings and namespace
- remove `GetFullHtmlFieldId` method; depends on `HtmlHelper` method that
  can't be static
- String -> string
- remove reference to a legacy bug
- convert internal `VisitedObjects` property to public `AddVisited()` method

Further cleanup
- remove explicit backing fields for remaining properties
- add copy constructor to replace code distributed around legacy MVC
- don't "combine and trim" in `GetFullHtmlFieldName()`
2014-03-27 16:01:29 -07:00
Ryan Nowak ffb73a1ed8 Fix build issues with Injector
This was causing intellisense failures in VS. It looks like the
commandline is able to accidentally pick up the compatability extensions
from the model binding assembly, but this is not the case in VS.

Changed this code not to rely on compatability extensions.
2014-03-27 15:07:28 -07:00
sornaks 007ac9443d WebFX-153: Add Content() and Json() to the Controller class. 2014-03-27 14:12:39 -07:00
Pranav K 44af396da9 Prefer string.Equals static method over the Equals instance method 2014-03-26 22:24:38 -07:00
Pranav K cb21c34770 Reintroduce ModelStateDictionaryTest 2014-03-26 17:32:45 -07:00
Pranav K 8e495158ef Modifying ModelStateDictionary to derive from IDictionary
* Reintroducing methods that weren't ported over earlier
2014-03-26 17:29:45 -07:00
Ryan Nowak 6da448fb8e Commonizing JSON writer/serializer code
This doesn't add any new extensibility, and will likely change again in
the future when we add extensibility. For now this is a stopgap to reduce
duplication between JsonResult and JsonViewComponentResult.
2014-03-26 17:02:44 -07:00
Ryan Nowak 469414c419 Adding support for scoped services in WebFX
We'll create a scoped service provider if the middleware that does it
isn't there.

We resolve all of our stuff from the scoped service provider, allowing
users to plug in any scoped things they want.

Ported UrlHelper to be a scoped service.
2014-03-26 12:45:36 -07:00
Ryan Nowak 21e48be06e Patternizing our property injection/initializer 2014-03-26 11:58:20 -07:00
dougbu 8ed5b7b079 Fix WebFx-169 and #118
- move `DynamicObject` derivation up to new `DynamicViewData` class, fixing [WebFx-169](http://projectk-tc:8080/browse/WEBFX-169)
- avoid direct `_data` lookup in previous `TryGetMember()`, fixing [#118](https://github.com/aspnet/WebFx/issues/118)
- rename ViewData -> ViewDataDictionary

Also
- flesh out `IDictionary<string, object>` implementation in `ViewData`
- provide `ViewData` copy constructor that allows TModel to change
- remove `TryGetIndex()` and `TrySetIndex()` implementations; use `ViewData[]` instead
- restore `ViewContext.ViewBag` from legacy MVC
2014-03-26 11:42:52 -07:00
Pranav K af7d61113b Updating test projects to use Microsoft.AspNet.Testing 2014-03-25 15:10:58 -07:00
Pranav K 12632c5fc3 Replacing not null checks in ModelBinding with NotNullAttribute : part deux 2014-03-25 15:10:57 -07:00
Ryan Nowak 6fb0d5b282 Commonize 'throw on view not found'
Deduping this code by moving it to ViewEngineResult.
2014-03-25 14:25:49 -07:00
Ryan Nowak fa21d1cd65 Remove extra TextWriter parameter from IView
This was here in the legacy code for legacy reasons. We're passing the writer
as part of the ViewContext, so we can remove this extra parameter.
2014-03-25 14:19:43 -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
Ryan Nowak 86ac978451 Implementation of ViewComponents 2014-03-25 11:04:37 -07:00