From fcb080658d945b02539b577f1cfcf50b5262c324 Mon Sep 17 00:00:00 2001 From: Sebastiaan Janssen Date: Mon, 7 Apr 2014 12:16:45 +0200 Subject: [PATCH] Reverting 221bfa5f3d848786cd4df7416bd9e2c54153e383 so that views are found in partials again Tested creating/editing members with custom properties in combination with our snippets and that seems to work fine now, so not sure what this was supposed to fix. Fixes U4-4604 Surface Controller functionality changed in 7.1 breaking site --- src/Umbraco.Web/Mvc/RenderViewEngine.cs | 36 +++++++++++++------------ 1 file changed, 19 insertions(+), 17 deletions(-) diff --git a/src/Umbraco.Web/Mvc/RenderViewEngine.cs b/src/Umbraco.Web/Mvc/RenderViewEngine.cs index c10e9460b3..89906980b9 100644 --- a/src/Umbraco.Web/Mvc/RenderViewEngine.cs +++ b/src/Umbraco.Web/Mvc/RenderViewEngine.cs @@ -92,25 +92,27 @@ namespace Umbraco.Web.Mvc /// /// /// - private bool ShouldFindView(ControllerContext controllerContext, bool isPartial) - { - var umbracoToken = controllerContext.GetDataTokenInViewContextHierarchy("umbraco"); + private bool ShouldFindView(ControllerContext controllerContext, bool isPartial) + { + //first check if we're rendering a partial view for the back office, or surface controller, etc... + //anything that is not IUmbracoRenderModel as this should only pertain to Umbraco views. + if (isPartial + && controllerContext.RouteData.DataTokens.ContainsKey("umbraco") + && !(controllerContext.RouteData.DataTokens["umbraco"] is RenderModel)) + { + return true; + } - //first check if we're rendering a partial view for the back office, or surface controller, etc... - //anything that is not IUmbracoRenderModel as this should only pertain to Umbraco views. - if (isPartial && umbracoToken is RenderModel) - { - return true; - } + //only find views if we're rendering the umbraco front end + if (controllerContext.RouteData.DataTokens.ContainsKey("umbraco") + && controllerContext.RouteData.DataTokens["umbraco"] != null + && controllerContext.RouteData.DataTokens["umbraco"] is RenderModel) + { + return true; + } - //only find views if we're rendering the umbraco front end - if (umbracoToken is RenderModel) - { - return true; - } - - return false; - } + return false; + } } } \ No newline at end of file