mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2025-09-22 20:13:50 +08:00
Continued work on theming fundamentals
--HG-- extra : convert_revision : svn%3A5ff7c347-ad56-4c35-b696-ccb81de16e03/trunk%4044118
This commit is contained in:
@@ -76,6 +76,7 @@
|
||||
<Compile Include="Common\ViewModels\BodyEditorViewModel.cs" />
|
||||
<Compile Include="Common\ViewModels\OwnerEditorViewModel.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="Themes\SafeModeThemeSelector.cs" />
|
||||
<Compile Include="Settings\AdminMenu.cs" />
|
||||
<Compile Include="Settings\Controllers\AdminController.cs" />
|
||||
<Compile Include="Settings\Models\SiteSettingsHandler.cs" />
|
||||
@@ -138,6 +139,7 @@
|
||||
<Content Include="Themes\Views\Models\EditorTemplates\ThemeSiteSettingsRecord.ascx" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Content Include="SafeMode\Theme.txt" />
|
||||
<Content Include="Themes\Views\Admin\Install.aspx" />
|
||||
<Content Include="Themes\Views\Web.config" />
|
||||
</ItemGroup>
|
||||
|
1
src/Orchard.Web/Core/SafeMode/Theme.txt
Normal file
1
src/Orchard.Web/Core/SafeMode/Theme.txt
Normal file
@@ -0,0 +1 @@
|
||||
name: SafeMode
|
25
src/Orchard.Web/Core/SafeMode/Views/Shared/_layout.ascx_
Normal file
25
src/Orchard.Web/Core/SafeMode/Views/Shared/_layout.ascx_
Normal file
@@ -0,0 +1,25 @@
|
||||
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<title>
|
||||
<asp:ContentPlaceHolder ID="TitleContent" runat="server" />
|
||||
</title>
|
||||
<link href="<%= ResolveUrl("../../Content/Site.css")%>" rel="stylesheet" type="text/css" />
|
||||
<link rel="wlwmanifest" type="application/wlwmanifest+xml" href="<%= ResolveUrl("~/xmlrpc/livewriter/manifest?r="+DateTime.UtcNow.Ticks) %>" />
|
||||
|
||||
</head>
|
||||
<body>
|
||||
<div class="page">
|
||||
<div id="header">
|
||||
<%Html.RenderPartial("Header"); %>
|
||||
<%Html.RenderPartial("Navigation"); %>
|
||||
</div>
|
||||
<div id="main">
|
||||
<asp:ContentPlaceHolder ID="MainContent" runat="server" />
|
||||
<div id="footer">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
10
src/Orchard.Web/Core/Themes/SafeModeThemeSelector.cs
Normal file
10
src/Orchard.Web/Core/Themes/SafeModeThemeSelector.cs
Normal file
@@ -0,0 +1,10 @@
|
||||
using System.Web.Routing;
|
||||
using Orchard.Themes;
|
||||
|
||||
namespace Orchard.Core.Themes {
|
||||
public class SafeModeThemeSelector : IThemeSelector {
|
||||
public ThemeSelectorResult GetTheme(RequestContext context) {
|
||||
return new ThemeSelectorResult {Priority = -100, ThemeName = "SafeMode"};
|
||||
}
|
||||
}
|
||||
}
|
@@ -10,19 +10,17 @@ using Orchard.Themes;
|
||||
|
||||
namespace Orchard.Core.Themes.Services {
|
||||
public class SiteThemeSelector : IThemeSelector {
|
||||
private readonly IThemeService _themeService;
|
||||
|
||||
public SiteThemeSelector (IThemeService themeService) {
|
||||
_themeService = themeService;
|
||||
}
|
||||
|
||||
public ISite CurrentSite { get; set; }
|
||||
|
||||
public ThemeSelectorResult GetTheme(RequestContext context) {
|
||||
var theme = _themeService.GetSiteTheme();
|
||||
if (theme == null) {
|
||||
string currentThemeName = CurrentSite.As<ThemeSiteSettings>().Record.CurrentThemeName;
|
||||
|
||||
if (String.IsNullOrEmpty(currentThemeName)) {
|
||||
return null;
|
||||
}
|
||||
return new ThemeSelectorResult {Priority = -5, ThemeName = theme.ThemeName};
|
||||
|
||||
return new ThemeSelectorResult { Priority = -5, ThemeName = currentThemeName };
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user