Continuing theming work...

--HG--
extra : convert_revision : svn%3A5ff7c347-ad56-4c35-b696-ccb81de16e03/trunk%4044184
This commit is contained in:
skewed
2009-12-16 22:22:15 +00:00
parent db2e53d086
commit eb079cddfc
5 changed files with 20 additions and 23 deletions

View File

@@ -1,15 +1,14 @@
<%@ Page Language="C#" Inherits="System.Web.Mvc.ViewPage" %> <%@ Page Language="C#" Inherits="System.Web.Mvc.ViewPage<BaseViewModel>" %>
<%@ Import Namespace="Orchard.Mvc.ViewModels"%>
<%@ Import Namespace="Orchard.Mvc.Html" <%@ Import Namespace="Orchard.Mvc.Html"
%><!DOCTYPE html> %><!DOCTYPE html>
<html> <html>
<head> <head>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" /> <meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
<title><%=Html.Title() %> - Safe Mode!</title><% <title><%=Html.Title() %> - Safe Mode!</title><%
Html.RenderZone("head", ":metas :styles :scripts"); %> Html.Zone("head", ":metas :styles :scripts"); %>
</head> </head>
<body><% <body><%
Html.RenderZone("document-first"); Html.ZoneBody("body"); %>
Html.RenderBody();
Html.RenderZone("document-last"); %>
</body> </body>
</html> </html>

View File

@@ -1,15 +1,16 @@
<%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl" %> <%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl<BaseViewModel>" %>
<%@ Import Namespace="Orchard.Mvc.ViewModels"%>
<%@ Import Namespace="Orchard.Mvc.Html" %><% <%@ Import Namespace="Orchard.Mvc.Html" %><%
Html.RegisterStyle("site.css"); %> Html.RegisterStyle("site.css"); %>
<div class="page"> <div class="page">
<div id="header"><% <div id="header"><%
Html.RenderZone("header"); Html.Zone("header");
Html.RenderZone("menu"); Html.Zone("menu");
%></div> %></div>
<div id="main"><% <div id="main"><%
Html.RenderBody(); Html.ZoneBody("content");
%> <div id="footer"><% %> <div id="footer"><%
Html.RenderZone("footer"); Html.Zone("footer");
%></div> %></div>
</div> </div>
</div> </div>

View File

@@ -1,23 +1,18 @@
using System.Collections.Generic; using System.Web.Mvc;
using System.Web.Mvc; using Orchard.Mvc.ViewModels;
using Orchard.Mvc.ModelBinders;
namespace Orchard.Controllers { namespace Orchard.Controllers {
[HandleError] [HandleError]
public class HomeController : Controller { public class HomeController : Controller {
public ActionResult Index() { public ActionResult Index() {
ViewData["Message"] = "Welcome to ASP.NET MVC!"; ViewData["Message"] = "Welcome to ASP.NET MVC!";
return View(); return View(new BaseViewModel());
} }
public ActionResult About() { public ActionResult About() {
return View(); return View();
} }
} }
} }

View File

@@ -41,7 +41,9 @@ namespace Orchard.Mvc.Html {
Zone(html, zoneName, string.Empty); Zone(html, zoneName, string.Empty);
} }
public static void RenderZone(this HtmlHelper html, string zoneName, string foo) { } public static void ZoneBody<TModel>(this HtmlHelper<TModel> html, string zoneName) where TModel : BaseViewModel {
html.Zone(zoneName, () => html.RenderBody());
}
public static void RegisterStyle(this HtmlHelper html, string styleName) { public static void RegisterStyle(this HtmlHelper html, string styleName) {
//todo: register the style //todo: register the style

View File

@@ -1,7 +1,6 @@
using System; using System.Linq;
using System.Collections.Generic;
using System.Linq;
using System.Web.Mvc; using System.Web.Mvc;
using Orchard.Mvc.ViewModels;
namespace Orchard.Mvc.ViewEngines { namespace Orchard.Mvc.ViewEngines {
public class LayoutViewEngine : IViewEngine { public class LayoutViewEngine : IViewEngine {
@@ -26,7 +25,8 @@ namespace Orchard.Mvc.ViewEngines {
// if action returned a View with explicit master - // if action returned a View with explicit master -
// this will bypass the multi-pass layout strategy // 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<string>()); return new ViewEngineResult(Enumerable.Empty<string>());
var bodyView = _viewEngines.FindPartialView(controllerContext, viewName); var bodyView = _viewEngines.FindPartialView(controllerContext, viewName);