mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2025-10-15 19:54:57 +08:00
Removed dup theme resource definitions. Fix base path on razor views.
--HG-- branch : dev
This commit is contained in:
@@ -232,6 +232,7 @@
|
||||
<Compile Include="Settings\Models\SiteSettingsPart.cs" />
|
||||
<Compile Include="Settings\Services\SiteService.cs" />
|
||||
<Compile Include="Settings\ViewModels\SiteSettingsPartViewModel.cs" />
|
||||
<Compile Include="Shapes\CoreShapesResourceManifest.cs" />
|
||||
<Compile Include="Shapes\CoreShapes.cs" />
|
||||
<Compile Include="XmlRpc\Controllers\HomeController.cs" />
|
||||
<Compile Include="XmlRpc\Controllers\LiveWriterController.cs" />
|
||||
|
15
src/Orchard.Web/Core/Shapes/CoreShapesResourceManifest.cs
Normal file
15
src/Orchard.Web/Core/Shapes/CoreShapesResourceManifest.cs
Normal file
@@ -0,0 +1,15 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using Orchard.UI.Resources;
|
||||
|
||||
namespace Orchard.Core.Shapes {
|
||||
public class CoreShapesResourceManifest : ResourceManifest {
|
||||
public CoreShapesResourceManifest() {
|
||||
DefineScript("ShapesBase").SetUrl("base.js").SetDependencies("jQuery");
|
||||
DefineStyle("Shapes").SetUrl("site.css"); // todo: missing
|
||||
DefineStyle("ShapesSpecial").SetUrl("special.css");
|
||||
}
|
||||
}
|
||||
}
|
@@ -63,7 +63,7 @@ namespace Orchard.Setup {
|
||||
builder.RegisterType<DefaultCommandManager>().As<ICommandManager>().InstancePerLifetimeScope();
|
||||
builder.RegisterType<HelpCommand>().As<ICommandHandler>().InstancePerLifetimeScope();
|
||||
builder.RegisterType<DefaultWorkContextAccessor>().As<IWorkContextAccessor>().InstancePerMatchingLifetimeScope("shell");
|
||||
builder.RegisterType<ThemesResourceManifest>().As<IResourceManifest>().InstancePerLifetimeScope();
|
||||
builder.RegisterType<CoreShapesResourceManifest>().As<IResourceManifest>().InstancePerLifetimeScope();
|
||||
builder.RegisterType<ResourceManager>().As<IResourceManager>().InstancePerLifetimeScope();
|
||||
builder.RegisterType<ResourceFilter>().As<IFilterProvider>().InstancePerLifetimeScope();
|
||||
|
||||
|
@@ -8,11 +8,40 @@ namespace Orchard.Themes {
|
||||
public class ThemesResourceManifest : ResourceManifest {
|
||||
public ThemesResourceManifest() {
|
||||
DefineStyle("ThemesAdmin").SetUrl("admin.css");
|
||||
|
||||
// todo: used by core\shapes -- move it?
|
||||
DefineScript("Switchable").SetUrl("jquery.switchable.js").SetDependencies("jQuery");
|
||||
|
||||
DefineStyle("Switchable").SetUrl("jquery.switchable.css");
|
||||
|
||||
// Resources for the built-in themes (under the orchard.web/themes directory)
|
||||
// The manifest would normally go there rather than here, but orchard.web/themes
|
||||
// is not registered with AutoFac.
|
||||
DefineStyle("Admin").SetUrl("~/modules/orchard.themes/styles/admin.css");
|
||||
|
||||
DefineStyle("Classic").SetUrl("~/themes/classic/styles/site.css");
|
||||
DefineStyle("Classic_Blog").SetUrl("~/themes/classic/styles/blog.css");
|
||||
|
||||
DefineStyle("ClassicDark").SetUrl("~/themes/classicdark/styles/site.css");
|
||||
DefineStyle("ClassicDark_Blog").SetUrl("~/themes/classicdark/styles/blog.css");
|
||||
|
||||
DefineStyle("Contoso").SetUrl("~/themes/contoso/styles/site.css");
|
||||
DefineStyle("Contoso_Search").SetUrl("~/themes/contoso/styles/search.css");
|
||||
|
||||
// todo: include and define the min.js version too
|
||||
// todo: move EasySlider to common location
|
||||
DefineScript("EasySlider").SetUrl("~/themes/contoso/scripts/easySlider.js").SetDependencies("jQuery");
|
||||
|
||||
DefineStyle("Corporate").SetUrl("~/themes/corporate/styles/site.css");
|
||||
|
||||
DefineStyle("Green").SetUrl("~/themes/green/styles/site.css");
|
||||
DefineStyle("Green_Blog").SetUrl("~/themes/green/styles/blog.css");
|
||||
DefineStyle("Green_YUI").SetUrl("~/themes/green/styles/yui.css");
|
||||
|
||||
DefineStyle("SafeMode").SetUrl("~/themes/safemode/styles/site.css");
|
||||
|
||||
DefineStyle("TheAdmin").SetUrl("~/themes/theadmin/styles/site.css");
|
||||
DefineStyle("TheAdmin_IE").SetUrl("~/themes/theadmin/styles/ie.css");
|
||||
DefineStyle("TheAdmin_IE6").SetUrl("~/themes/theadmin/styles/ie6.css");
|
||||
DefineScript("TheAdmin").SetUrl("~/themes/theadmin/scripts/admin.js").SetDependencies("jQuery");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -94,7 +94,6 @@
|
||||
<DependentUpon>Global.asax</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="Themes\ThemesResourceManifest.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Content Include="Default.aspx" />
|
||||
|
@@ -2,7 +2,7 @@
|
||||
@{
|
||||
Script.Require("jQuery", "1.4.2");
|
||||
Script.Require("ShapesBase");
|
||||
Style.Require("SafeMode");
|
||||
Style.Require("SafeMode").Define(d => d.SetUrl("site.css"));
|
||||
RegisterLink(new LinkEntry { Condition = "lte IE 6", Rel = "stylesheet", Type="text/css", Href = Href("../Styles/ie6.css")}.AddAttribute("media", "screen, projection"));
|
||||
}
|
||||
<div id="header">
|
||||
|
@@ -1,39 +0,0 @@
|
||||
using Orchard.UI.Resources;
|
||||
|
||||
namespace Orchard.Themes {
|
||||
public class ThemesResourceManifest : ResourceManifest {
|
||||
public ThemesResourceManifest() {
|
||||
DefineStyle("Admin").SetUrl("~/modules/orchard.themes/styles/admin.css");
|
||||
|
||||
DefineScript("ShapesBase").SetUrl("~/core/shapes/scripts/base.js").SetDependencies("jQuery");
|
||||
DefineStyle("Shapes").SetUrl("~/core/shapes/styles/site.css"); // todo: missing
|
||||
DefineStyle("ShapesSpecial").SetUrl("~/core/shapes/styles/special.css");
|
||||
|
||||
DefineStyle("Classic").SetUrl("~/themes/classic/styles/site.css");
|
||||
DefineStyle("Classic_Blog").SetUrl("~/themes/classic/styles/blog.css");
|
||||
|
||||
DefineStyle("ClassicDark").SetUrl("~/themes/classicdark/styles/site.css");
|
||||
DefineStyle("ClassicDark_Blog").SetUrl("~/themes/classicdark/styles/blog.css");
|
||||
|
||||
DefineStyle("Contoso").SetUrl("~/themes/contoso/styles/site.css");
|
||||
DefineStyle("Contoso_Search").SetUrl("~/themes/contoso/styles/search.css");
|
||||
|
||||
// todo: include and define the min.js version too
|
||||
// todo: move EasySlider to common location
|
||||
DefineScript("EasySlider").SetUrl("~/themes/contoso/scripts/easySlider.js").SetDependencies("jQuery");
|
||||
|
||||
DefineStyle("Corporate").SetUrl("~/themes/corporate/styles/site.css");
|
||||
|
||||
DefineStyle("Green").SetUrl("~/themes/green/styles/site.css");
|
||||
DefineStyle("Green_Blog").SetUrl("~/themes/green/styles/blog.css");
|
||||
DefineStyle("Green_YUI").SetUrl("~/themes/green/styles/yui.css");
|
||||
|
||||
DefineStyle("SafeMode").SetUrl("~/themes/safemode/styles/site.css");
|
||||
|
||||
DefineStyle("TheAdmin").SetUrl("~/themes/theadmin/styles/site.css");
|
||||
DefineStyle("TheAdmin_IE").SetUrl("~/themes/theadmin/styles/ie.css");
|
||||
DefineStyle("TheAdmin_IE6").SetUrl("~/themes/theadmin/styles/ie6.css");
|
||||
DefineScript("TheAdmin").SetUrl("~/themes/theadmin/scripts/admin.js").SetDependencies("jQuery");
|
||||
}
|
||||
}
|
||||
}
|
@@ -195,7 +195,7 @@ namespace Orchard.UI.Resources {
|
||||
url = Path.ChangeExtension(url, nearestCulture + "." + Path.GetExtension(url));
|
||||
}
|
||||
}
|
||||
if (!Uri.IsWellFormedUriString(url, UriKind.Absolute) && !VirtualPathUtility.IsAbsolute(url) && !VirtualPathUtility.IsAppRelative(url)) {
|
||||
if (!Uri.IsWellFormedUriString(url, UriKind.Absolute) && !VirtualPathUtility.IsAbsolute(url) && !VirtualPathUtility.IsAppRelative(url) && !String.IsNullOrEmpty(BasePath)) {
|
||||
// relative urls are relative to the base path of the module that defined the manifest
|
||||
url = VirtualPathUtility.Combine(BasePath, url);
|
||||
}
|
||||
|
@@ -50,42 +50,4 @@ namespace Orchard.UI.Resources {
|
||||
|
||||
internal class DynamicResourceManifest : ResourceManifest {
|
||||
}
|
||||
|
||||
public class ThemesResourceManifest : ResourceManifest {
|
||||
public ThemesResourceManifest() {
|
||||
// todo: wrong place to define all these resources.
|
||||
// But the ResourceManifest defined in Orchard.Web/themes is not loading for some reason
|
||||
DefineStyle("Admin").SetUrl("~/modules/orchard.themes/styles/admin.css");
|
||||
|
||||
DefineScript("ShapesBase").SetUrl("~/core/shapes/scripts/base.js").SetDependencies("jQuery");
|
||||
DefineStyle("Shapes").SetUrl("~/core/shapes/styles/site.css"); // todo: missing
|
||||
DefineStyle("ShapesSpecial").SetUrl("~/core/shapes/styles/special.css");
|
||||
|
||||
DefineStyle("Classic").SetUrl("~/themes/classic/styles/site.css");
|
||||
DefineStyle("Classic_Blog").SetUrl("~/themes/classic/styles/blog.css");
|
||||
|
||||
DefineStyle("ClassicDark").SetUrl("~/themes/classicdark/styles/site.css");
|
||||
DefineStyle("ClassicDark_Blog").SetUrl("~/themes/classicdark/styles/blog.css");
|
||||
|
||||
DefineStyle("Contoso").SetUrl("~/themes/contoso/styles/site.css");
|
||||
DefineStyle("Contoso_Search").SetUrl("~/themes/contoso/styles/search.css");
|
||||
|
||||
// todo: include and define the min.js version too
|
||||
// todo: move EasySlider to common location?
|
||||
DefineScript("EasySlider").SetUrl("~/themes/contoso/scripts/easySlider.js").SetDependencies("jQuery");
|
||||
|
||||
DefineStyle("Corporate").SetUrl("~/themes/corporate/styles/site.css");
|
||||
|
||||
DefineStyle("Green").SetUrl("~/themes/green/styles/site.css");
|
||||
DefineStyle("Green_Blog").SetUrl("~/themes/green/styles/blog.css");
|
||||
DefineStyle("Green_YUI").SetUrl("~/themes/green/styles/yui.css");
|
||||
|
||||
DefineStyle("SafeMode").SetUrl("~/themes/safemode/styles/site.css");
|
||||
|
||||
DefineStyle("TheAdmin").SetUrl("~/themes/theadmin/styles/site.css");
|
||||
DefineStyle("TheAdmin_IE").SetUrl("~/themes/theadmin/styles/ie.css");
|
||||
DefineStyle("TheAdmin_IE6").SetUrl("~/themes/theadmin/styles/ie6.css");
|
||||
DefineScript("TheAdmin").SetUrl("~/themes/theadmin/scripts/admin.js").SetDependencies("jQuery");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -5,13 +5,23 @@ using System.Text;
|
||||
using System.Web.Mvc;
|
||||
using System.Web.UI;
|
||||
using JetBrains.Annotations;
|
||||
using Microsoft.WebPages;
|
||||
|
||||
namespace Orchard.UI.Resources {
|
||||
public class ResourceRegister {
|
||||
private readonly TemplateControl _templateContainer;
|
||||
private string _baseVirtualPath;
|
||||
|
||||
public ResourceRegister(IViewDataContainer container, IResourceManager resourceManager, string resourceType) {
|
||||
_templateContainer = container as TemplateControl;
|
||||
var templateControl = container as TemplateControl;
|
||||
if (templateControl != null) {
|
||||
_baseVirtualPath = templateControl.AppRelativeVirtualPath;
|
||||
}
|
||||
else {
|
||||
var webPage = container as WebPageBase;
|
||||
if (webPage != null) {
|
||||
_baseVirtualPath = webPage.VirtualPath;
|
||||
}
|
||||
}
|
||||
ResourceManager = resourceManager;
|
||||
ResourceType = resourceType;
|
||||
}
|
||||
@@ -26,8 +36,8 @@ namespace Orchard.UI.Resources {
|
||||
public virtual RequireSettings Require(string resourceName, string minimumVersion) {
|
||||
var settings = ResourceManager.Require(ResourceType, resourceName)
|
||||
.WithMinimumVersion(minimumVersion);
|
||||
if (_templateContainer != null) {
|
||||
settings.WithBasePath(ResourceDefinition.GetBasePathFromViewPath(ResourceType, _templateContainer.AppRelativeVirtualPath));
|
||||
if (_baseVirtualPath != null) {
|
||||
settings.WithBasePath(ResourceDefinition.GetBasePathFromViewPath(ResourceType, _baseVirtualPath));
|
||||
}
|
||||
return settings;
|
||||
}
|
||||
|
Reference in New Issue
Block a user