Midway through template refactoring. CURRENTLY BROKEN.

--HG--
extra : convert_revision : svn%3A5ff7c347-ad56-4c35-b696-ccb81de16e03/trunk%4044393
This commit is contained in:
loudej
2009-12-21 08:24:39 +00:00
parent 40bef93bf1
commit 437a19aed7
70 changed files with 629 additions and 157 deletions

View File

@@ -141,12 +141,15 @@
<Content Include="Themes\Styles\site.css" />
<Content Include="Themes\Views\Admin\Install.aspx" />
<Content Include="Themes\Views\document.aspx" />
<Content Include="Themes\Views\Shared\EditorTemplates\ThemeSiteSettingsRecord.ascx" />
<Content Include="Themes\Views\Shared\layout.ascx" />
<Content Include="Themes\Views\Shared\user.ascx" />
<Content Include="Themes\Views\Shared\menu.ascx" />
<Content Include="Themes\Views\EditorTemplates\Parts\Themes.SiteSettings.ascx" />
<Content Include="Themes\Views\layout.ascx" />
<Content Include="Themes\Views\user.ascx" />
<Content Include="Themes\Views\menu.ascx" />
<Content Include="Themes\Views\Web.config" />
</ItemGroup>
<ItemGroup>
<Folder Include="Themes\Views\Shared\" />
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<Import Project="$(MSBuildExtensionsPath)\Microsoft\VisualStudio\v9.0\WebApplications\Microsoft.WebApplication.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.

View File

@@ -23,7 +23,6 @@ namespace Orchard.Core.Themes.Controllers {
}
public Localizer T { get; set; }
public IUser CurrentUser { get; set; }
public ActionResult Index() {
try {

View File

@@ -10,7 +10,7 @@ namespace Orchard.Core.Themes.Models {
_themeSiteSettingsRepository = repository;
Filters.Add(new ActivatingFilter<ThemeSiteSettings>("site"));
Filters.Add(new StorageFilter<ThemeSiteSettingsRecord>(_themeSiteSettingsRepository) { AutomaticallyCreateMissingRecord = true });
Filters.Add(new TemplateFilterForRecord<ThemeSiteSettingsRecord>("ThemeSiteSettings"));
Filters.Add(new TemplateFilterForRecord<ThemeSiteSettingsRecord>("ThemeSiteSettings", "Parts/Themes.SiteSettings"));
}
}
}

View File

@@ -3,6 +3,7 @@ using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Routing;
using JetBrains.Annotations;
using Orchard.Core.Themes.Models;
using Orchard.Models;
using Orchard.Settings;
@@ -11,8 +12,8 @@ using Orchard.Themes;
namespace Orchard.Core.Themes.Services {
public class SiteThemeSelector : IThemeSelector {
public ISite CurrentSite { get; set; }
protected virtual ISite CurrentSite { get; [UsedImplicitly] private set; }
public ThemeSelectorResult GetTheme(RequestContext context) {
string currentThemeName = CurrentSite.As<ThemeSiteSettings>().Record.CurrentThemeName;

View File

@@ -3,6 +3,7 @@ using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Routing;
using JetBrains.Annotations;
using Orchard.Extensions;
using Orchard.Logging;
using Orchard.Models;
@@ -24,7 +25,7 @@ namespace Orchard.Core.Themes.Services {
}
public ILogger Logger { get; set; }
public ISite CurrentSite { get; set; }
protected virtual ISite CurrentSite { get; [UsedImplicitly] private set; }
#region Implementation of IThemeService

View File

@@ -0,0 +1,10 @@
<%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl<ThemeSiteSettingsRecord>" %>
<%@ Import Namespace="Orchard.Core.Themes.Records"%>
<h3>Themes</h3>
<ol>
<li>
<%= Html.LabelFor(x=>x.CurrentThemeName) %>
<%= Html.EditorFor(x=>x.CurrentThemeName) %>
<%= Html.ValidationMessage("CurrentThemeName", "*")%>
</li>
</ol>

View File

@@ -0,0 +1,21 @@
<%@ 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">
<div id="title"><h1>My MVC Application</h1></div><%
Html.Zone("header");
Html.Zone("menu"); %>
<%-- todo:(nheskew) this will need to all go in the header zone (user widget) --%>
<% Html.Include("user"); %>
<%-- todo:(nheskew) this will need to be a generated menu --%>
<% Html.Include("menu"); %>
</div>
<div id="main"><%
Html.ZoneBody("content");
%> <div id="footer"><%
Html.Zone("footer");
%></div>
</div>
</div>

View File

@@ -0,0 +1,9 @@
<%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl" %>
<div id="menucontainer">
<ul id="menu">
<li><%= Html.ActionLink("Home", "Index", "Home", new {Area = ""}, new {})%></li>
<li><%= Html.ActionLink("About", "About", "Home", new {Area = ""}, new {})%></li>
<li><%= Html.ActionLink("Blogs", "List", "Blog", new {Area = "Orchard.Blogs"}, new {})%></li>
<li><%= Html.ActionLink("Admin", "List", new {Area = "Orchard.Blogs", Controller = "BlogAdmin"})%></li>
</ul>
</div>

View File

@@ -0,0 +1,8 @@
<%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl" %>
<div id="logindisplay"><%
if (Request.IsAuthenticated) {
%>Welcome <strong><%=Html.Encode(Page.User.Identity.Name) %></strong>! [<%=Html.ActionLink("Log Off", "LogOff", "Account", new { area = "" }, new { }) %>]<%
} else {
%>[<%=Html.ActionLink("Log On", "LogOn", "Account", new{area=""}, new{}) %>]<%
}
%></div>