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"
%><!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
<title><%=Html.Title() %> - Safe Mode!</title><%
Html.RenderZone("head", ":metas :styles :scripts"); %>
Html.Zone("head", ":metas :styles :scripts"); %>
</head>
<body><%
Html.RenderZone("document-first");
Html.RenderBody();
Html.RenderZone("document-last"); %>
Html.ZoneBody("body"); %>
</body>
</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" %><%
Html.RegisterStyle("site.css"); %>
<div class="page">
<div id="header"><%
Html.RenderZone("header");
Html.RenderZone("menu");
Html.Zone("header");
Html.Zone("menu");
%></div>
<div id="main"><%
Html.RenderBody();
Html.ZoneBody("content");
%> <div id="footer"><%
Html.RenderZone("footer");
Html.Zone("footer");
%></div>
</div>
</div>

View File

@@ -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();
}
}
}

View File

@@ -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<TModel>(this HtmlHelper<TModel> html, string zoneName) where TModel : BaseViewModel {
html.Zone(zoneName, () => html.RenderBody());
}
public static void RegisterStyle(this HtmlHelper html, string styleName) {
//todo: register the style

View File

@@ -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<string>());
var bodyView = _viewEngines.FindPartialView(controllerContext, viewName);