From fceea540ba5302e6adb23608cf3c0f966a4e96fc Mon Sep 17 00:00:00 2001 From: Nathan Heskew Date: Wed, 8 Sep 2010 01:02:03 -0700 Subject: [PATCH] Some shape template cleanup (mainly in core shapes) --HG-- branch : theming --- src/Orchard.Web/Core/Orchard.Core.csproj | 9 +++--- .../Core/Shapes/Views/Document.aspx_ | 18 ----------- .../Core/Shapes/Views/Document.cshtml | 31 +++++++----------- .../Core/Shapes/Views/HeadPreload.ascx | 5 --- src/Orchard.Web/Core/Shapes/Views/Header.ascx | 3 -- .../Core/Shapes/Views/Header.cshtml | 4 +++ .../Core/Shapes/Views/Layout.ascx_ | 32 ------------------- .../Core/Shapes/Views/Layout.cshtml | 32 +++++++++++++++++++ src/Orchard.Web/Core/Shapes/Views/User.ascx_ | 11 ------- src/Orchard.Web/Core/Shapes/Views/User.cshtml | 13 ++++++++ src/Orchard.Web/Orchard.Web.csproj | 9 +++--- .../Views/{Header.ascx => Header.ascx_} | 0 .../Contoso/Views/Layout-HomePage.cshtml | 5 --- ...ut.HomePage.ascx => Layout.HomePage.ascx_} | 0 .../Views/{Layout.ascx => Layout.ascx_} | 0 .../Contoso/Views/{User.ascx => User.ascx_} | 0 16 files changed, 69 insertions(+), 103 deletions(-) delete mode 100644 src/Orchard.Web/Core/Shapes/Views/Document.aspx_ delete mode 100644 src/Orchard.Web/Core/Shapes/Views/Header.ascx create mode 100644 src/Orchard.Web/Core/Shapes/Views/Header.cshtml delete mode 100644 src/Orchard.Web/Core/Shapes/Views/Layout.ascx_ create mode 100644 src/Orchard.Web/Core/Shapes/Views/Layout.cshtml delete mode 100644 src/Orchard.Web/Core/Shapes/Views/User.ascx_ create mode 100644 src/Orchard.Web/Core/Shapes/Views/User.cshtml rename src/Orchard.Web/Themes/Contoso/Views/{Header.ascx => Header.ascx_} (100%) delete mode 100644 src/Orchard.Web/Themes/Contoso/Views/Layout-HomePage.cshtml rename src/Orchard.Web/Themes/Contoso/Views/{_Layout.HomePage.ascx => Layout.HomePage.ascx_} (100%) rename src/Orchard.Web/Themes/Contoso/Views/{Layout.ascx => Layout.ascx_} (100%) rename src/Orchard.Web/Themes/Contoso/Views/{User.ascx => User.ascx_} (100%) diff --git a/src/Orchard.Web/Core/Orchard.Core.csproj b/src/Orchard.Web/Core/Orchard.Core.csproj index 31c1feffb..dc5012327 100644 --- a/src/Orchard.Web/Core/Orchard.Core.csproj +++ b/src/Orchard.Web/Core/Orchard.Core.csproj @@ -337,7 +337,6 @@ - @@ -402,15 +401,15 @@ - - - + + + + - diff --git a/src/Orchard.Web/Core/Shapes/Views/Document.aspx_ b/src/Orchard.Web/Core/Shapes/Views/Document.aspx_ deleted file mode 100644 index 6c504e4d6..000000000 --- a/src/Orchard.Web/Core/Shapes/Views/Document.aspx_ +++ /dev/null @@ -1,18 +0,0 @@ -<%@ Page Language="C#" Inherits="System.Web.Mvc.ViewPage" %> -<%@ Import Namespace="Orchard.Mvc.ViewModels"%> -<%@ Import Namespace="Orchard.Mvc.Html" -%> - - - <%: Html.Title(Html.SiteName()) %> - " /><% - //todo: (heskew) have resource modules that can be leaned on (like a jQuery module that knows about various CDNs and jQuery's version and min naming schemes) - //todo: (heskew) this is an interim solution to inlude jQuery in every page and still allow that to be overriden in some theme by it containing a headScripts partial - Model.Zones.AddRenderPartial("head:before", "HeadPreload", Model); - Html.Zone("head", ":metas :styles :scripts"); %> - - -<% - Html.ZoneBody("body"); %> - - diff --git a/src/Orchard.Web/Core/Shapes/Views/Document.cshtml b/src/Orchard.Web/Core/Shapes/Views/Document.cshtml index 4fa453beb..d757058d7 100644 --- a/src/Orchard.Web/Core/Shapes/Views/Document.cshtml +++ b/src/Orchard.Web/Core/Shapes/Views/Document.cshtml @@ -1,28 +1,21 @@ @using Orchard.Mvc.Html -@{ - Model.Body.Add(Model.Metadata.ChildContent, "5"); -} - - -@//"en" needs to change to the current culture, btw -@//all inline styles for tmp reference only - - - Page Title@{/*View.Page.Title*/} + + + + + @View.Page .Title @//could be a resource - at least need to get at the right location and this is something - + @{ //todo: (heskew) have resource modules that can be leaned on (like a jQuery module that knows about various CDNs and jQuery's version and min naming schemes) //todo: (heskew) this is an interim solution to inlude jQuery in every page and still allow that to be overriden in some theme by it containing a headScripts partial } @//Model.Zones.AddRenderPartial("head:before", "HeadPreload", Model); @//Html.Zone("head", ":metas :styles :scripts"); %> - - - -
-

document template

- @Display(Model.Body) -
+ + + +@{ Model.Body.Add(Model.Metadata.ChildContent, "5"); } +@Display(Model.Body) - + \ No newline at end of file diff --git a/src/Orchard.Web/Core/Shapes/Views/HeadPreload.ascx b/src/Orchard.Web/Core/Shapes/Views/HeadPreload.ascx index ca0dad3e2..79894478a 100644 --- a/src/Orchard.Web/Core/Shapes/Views/HeadPreload.ascx +++ b/src/Orchard.Web/Core/Shapes/Views/HeadPreload.ascx @@ -1,8 +1,3 @@ <%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl" %> <% -// a CSS file for styling things (e.g. content item edit buttons) for users with elevated privileges (in this case, anyone who is authenticated) -if (Request.IsAuthenticated) { Html.RegisterStyle("special.css"); } - -Html.RegisterScript("jquery-1.4.2.js", "1"); // <- change to .min.js for use on a real site :) -Html.RegisterFootScript("base.js", "1"); %> \ No newline at end of file diff --git a/src/Orchard.Web/Core/Shapes/Views/Header.ascx b/src/Orchard.Web/Core/Shapes/Views/Header.ascx deleted file mode 100644 index 394a60d93..000000000 --- a/src/Orchard.Web/Core/Shapes/Views/Header.ascx +++ /dev/null @@ -1,3 +0,0 @@ -<%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl" %> -<%@ Import Namespace="Orchard.Mvc.Html"%> -
<%: Html.SiteName() %>
diff --git a/src/Orchard.Web/Core/Shapes/Views/Header.cshtml b/src/Orchard.Web/Core/Shapes/Views/Header.cshtml new file mode 100644 index 000000000..5328e6011 --- /dev/null +++ b/src/Orchard.Web/Core/Shapes/Views/Header.cshtml @@ -0,0 +1,4 @@ +@using Orchard.Mvc.Html +
+

@Html.SiteName()

+
\ No newline at end of file diff --git a/src/Orchard.Web/Core/Shapes/Views/Layout.ascx_ b/src/Orchard.Web/Core/Shapes/Views/Layout.ascx_ deleted file mode 100644 index fa2b32133..000000000 --- a/src/Orchard.Web/Core/Shapes/Views/Layout.ascx_ +++ /dev/null @@ -1,32 +0,0 @@ -<%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl" %> -<%@ Import Namespace="Orchard.Mvc.Html"%> -<%@ Import Namespace="Orchard.Mvc.ViewModels"%><% -Html.RegisterStyle("site.css"); -Model.Zones.AddRenderPartial("header", "Header", Model); -Model.Zones.AddRenderPartial("header:after", "User", Model); -Model.Zones.AddRenderPartial("menu", "Menu", Model); -%> -
- -
-
-
<% - Html.ZoneBody("primary"); - %>
-
-
- -
- <%-- put outside of #main? --%> -
- -
-
-
\ No newline at end of file diff --git a/src/Orchard.Web/Core/Shapes/Views/Layout.cshtml b/src/Orchard.Web/Core/Shapes/Views/Layout.cshtml new file mode 100644 index 000000000..a99787ed1 --- /dev/null +++ b/src/Orchard.Web/Core/Shapes/Views/Layout.cshtml @@ -0,0 +1,32 @@ +@// Html.RegisterStyle("site.css"); +
+ +
+
+
+@Display(Model.Content) +
+
+ +
+ +
\ No newline at end of file diff --git a/src/Orchard.Web/Core/Shapes/Views/User.ascx_ b/src/Orchard.Web/Core/Shapes/Views/User.ascx_ deleted file mode 100644 index ef473bf37..000000000 --- a/src/Orchard.Web/Core/Shapes/Views/User.ascx_ +++ /dev/null @@ -1,11 +0,0 @@ -<%@ Control Language="C#" Inherits="Orchard.Mvc.ViewUserControl" %> -<%@ Import Namespace="Orchard.Mvc.ViewModels"%> -
-<% if (Request.IsAuthenticated) { %> - <%: T("Welcome, {0}!", Page.User.Identity.Name) %> - <%: Html.ActionLink(T("Log Off").ToString(), "LogOff", new { Controller = "Account", Area = "Orchard.Users", ReturnUrl = Context.Request.RawUrl })%> -  | <%: Html.ActionLink("Admin", "Index", new {Area = "Dashboard", Controller = "Admin"})%> -<% } else { %> - <%: Html.ActionLink(T("Log On").ToString(), "LogOn", new { Controller = "Account", Area = "Orchard.Users", ReturnUrl = Context.Request.RawUrl }) %> -<% } %> -
\ No newline at end of file diff --git a/src/Orchard.Web/Core/Shapes/Views/User.cshtml b/src/Orchard.Web/Core/Shapes/Views/User.cshtml new file mode 100644 index 000000000..884193acc --- /dev/null +++ b/src/Orchard.Web/Core/Shapes/Views/User.cshtml @@ -0,0 +1,13 @@ +@using System.Web.Mvc +@using Orchard.Security +@{ var user = Html.Resolve().GetAuthenticatedUser(); } + +
+@if (Request.IsAuthenticated) { + @T("Welcome, {0}!", user.UserName) + @Html.ActionLink(T("Log Off").ToString(), "LogOff", new { Controller = "Account", Area = "Orchard.Users", ReturnUrl = Context.Request.RawUrl }) + @:| @Html.ActionLink("Admin", "Index", new {Area = "Dashboard", Controller = "Admin"}) +} else { + @Html.ActionLink(T("Log On").ToString(), "LogOn", new { Controller = "Account", Area = "Orchard.Users", ReturnUrl = Context.Request.RawUrl }) +} +
\ No newline at end of file diff --git a/src/Orchard.Web/Orchard.Web.csproj b/src/Orchard.Web/Orchard.Web.csproj index 48f76baa0..2f3b2da1a 100644 --- a/src/Orchard.Web/Orchard.Web.csproj +++ b/src/Orchard.Web/Orchard.Web.csproj @@ -142,8 +142,10 @@ + - + + @@ -208,17 +210,14 @@ - - - - + diff --git a/src/Orchard.Web/Themes/Contoso/Views/Header.ascx b/src/Orchard.Web/Themes/Contoso/Views/Header.ascx_ similarity index 100% rename from src/Orchard.Web/Themes/Contoso/Views/Header.ascx rename to src/Orchard.Web/Themes/Contoso/Views/Header.ascx_ diff --git a/src/Orchard.Web/Themes/Contoso/Views/Layout-HomePage.cshtml b/src/Orchard.Web/Themes/Contoso/Views/Layout-HomePage.cshtml deleted file mode 100644 index 3b2f32a55..000000000 --- a/src/Orchard.Web/Themes/Contoso/Views/Layout-HomePage.cshtml +++ /dev/null @@ -1,5 +0,0 @@ -@using Orchard.Mvc.Html -
-

Contoso Layout.HomePage template

-@Html.RenderOrchardBody() -
\ No newline at end of file diff --git a/src/Orchard.Web/Themes/Contoso/Views/_Layout.HomePage.ascx b/src/Orchard.Web/Themes/Contoso/Views/Layout.HomePage.ascx_ similarity index 100% rename from src/Orchard.Web/Themes/Contoso/Views/_Layout.HomePage.ascx rename to src/Orchard.Web/Themes/Contoso/Views/Layout.HomePage.ascx_ diff --git a/src/Orchard.Web/Themes/Contoso/Views/Layout.ascx b/src/Orchard.Web/Themes/Contoso/Views/Layout.ascx_ similarity index 100% rename from src/Orchard.Web/Themes/Contoso/Views/Layout.ascx rename to src/Orchard.Web/Themes/Contoso/Views/Layout.ascx_ diff --git a/src/Orchard.Web/Themes/Contoso/Views/User.ascx b/src/Orchard.Web/Themes/Contoso/Views/User.ascx_ similarity index 100% rename from src/Orchard.Web/Themes/Contoso/Views/User.ascx rename to src/Orchard.Web/Themes/Contoso/Views/User.ascx_