diff --git a/src/Orchard.Web/Core/Themes/Views/Shared/document.aspx b/src/Orchard.Web/Core/Themes/Views/Shared/document.aspx index 0cd3bb268..ff2441edf 100644 --- a/src/Orchard.Web/Core/Themes/Views/Shared/document.aspx +++ b/src/Orchard.Web/Core/Themes/Views/Shared/document.aspx @@ -1,15 +1,14 @@ -<%@ Page Language="C#" Inherits="System.Web.Mvc.ViewPage" %> +<%@ Page Language="C#" Inherits="System.Web.Mvc.ViewPage" %> +<%@ Import Namespace="Orchard.Mvc.ViewModels"%> <%@ Import Namespace="Orchard.Mvc.Html" %> <%=Html.Title() %> - Safe Mode!<% - Html.RenderZone("head", ":metas :styles :scripts"); %> + Html.Zone("head", ":metas :styles :scripts"); %> <% - Html.RenderZone("document-first"); - Html.RenderBody(); - Html.RenderZone("document-last"); %> + Html.ZoneBody("body"); %> diff --git a/src/Orchard.Web/Core/Themes/Views/Shared/layout.ascx b/src/Orchard.Web/Core/Themes/Views/Shared/layout.ascx index 98ac8429f..a64bc8652 100644 --- a/src/Orchard.Web/Core/Themes/Views/Shared/layout.ascx +++ b/src/Orchard.Web/Core/Themes/Views/Shared/layout.ascx @@ -1,15 +1,16 @@ -<%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl" %> +<%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl" %> +<%@ Import Namespace="Orchard.Mvc.ViewModels"%> <%@ Import Namespace="Orchard.Mvc.Html" %><% Html.RegisterStyle("site.css"); %>
<% - Html.RenderBody(); + Html.ZoneBody("content"); %>
\ No newline at end of file diff --git a/src/Orchard/Controllers/HomeController.cs b/src/Orchard/Controllers/HomeController.cs index b7f4c01be..ba479ad34 100644 --- a/src/Orchard/Controllers/HomeController.cs +++ b/src/Orchard/Controllers/HomeController.cs @@ -1,23 +1,18 @@ -using System.Collections.Generic; -using System.Web.Mvc; -using Orchard.Mvc.ModelBinders; +using System.Web.Mvc; +using Orchard.Mvc.ViewModels; namespace Orchard.Controllers { [HandleError] public class HomeController : Controller { - - public ActionResult Index() { ViewData["Message"] = "Welcome to ASP.NET MVC!"; - return View(); + return View(new BaseViewModel()); } public ActionResult About() { return View(); } - } - } \ No newline at end of file diff --git a/src/Orchard/Mvc/Html/LayoutExtensions.cs b/src/Orchard/Mvc/Html/LayoutExtensions.cs index ea54fe578..1016bd857 100644 --- a/src/Orchard/Mvc/Html/LayoutExtensions.cs +++ b/src/Orchard/Mvc/Html/LayoutExtensions.cs @@ -41,7 +41,9 @@ namespace Orchard.Mvc.Html { Zone(html, zoneName, string.Empty); } - public static void RenderZone(this HtmlHelper html, string zoneName, string foo) { } + public static void ZoneBody(this HtmlHelper html, string zoneName) where TModel : BaseViewModel { + html.Zone(zoneName, () => html.RenderBody()); + } public static void RegisterStyle(this HtmlHelper html, string styleName) { //todo: register the style diff --git a/src/Orchard/Mvc/ViewEngines/LayoutViewEngine.cs b/src/Orchard/Mvc/ViewEngines/LayoutViewEngine.cs index 40d620bb0..498dd73d6 100644 --- a/src/Orchard/Mvc/ViewEngines/LayoutViewEngine.cs +++ b/src/Orchard/Mvc/ViewEngines/LayoutViewEngine.cs @@ -1,7 +1,6 @@ -using System; -using System.Collections.Generic; -using System.Linq; +using System.Linq; using System.Web.Mvc; +using Orchard.Mvc.ViewModels; namespace Orchard.Mvc.ViewEngines { public class LayoutViewEngine : IViewEngine { @@ -26,7 +25,8 @@ namespace Orchard.Mvc.ViewEngines { // if action returned a View with explicit master - // this will bypass the multi-pass layout strategy - if (!string.IsNullOrEmpty(masterName)) + if (!string.IsNullOrEmpty(masterName) + || !(controllerContext.Controller.ViewData.Model is BaseViewModel)) return new ViewEngineResult(Enumerable.Empty()); var bodyView = _viewEngines.FindPartialView(controllerContext, viewName);