diff --git a/src/Orchard/UI/Resources/ResourceManager.cs b/src/Orchard/UI/Resources/ResourceManager.cs
index c54560d1c..cca163a38 100644
--- a/src/Orchard/UI/Resources/ResourceManager.cs
+++ b/src/Orchard/UI/Resources/ResourceManager.cs
@@ -1,14 +1,12 @@
using System.Collections.Generic;
using System.Linq;
using System.Web.Mvc;
-using Orchard.Extensions;
+using JetBrains.Annotations;
using Orchard.Mvc.Html;
-using Orchard.Themes;
namespace Orchard.UI.Resources {
+ [UsedImplicitly]
public class ResourceManager : IResourceManager {
- private readonly IThemeService _themeService;
- private readonly IExtensionManager _extensionManager;
private const string MetaFormat = "\r\n";
private const string StyleFormat = "\r\n";
private const string ScriptFormat = "\r\n";
@@ -17,11 +15,7 @@ namespace Orchard.UI.Resources {
private readonly List _headScripts;
private readonly List _footScripts;
- public ResourceManager(IThemeService themeService,
- IExtensionManager extensionManager) {
- _themeService = themeService;
- _extensionManager = extensionManager;
- //TODO: (erikpo) Not sure if generator should be initialized here or somewhere else
+ public ResourceManager() {
_metas = new Dictionary(20) {{"generator", "Orchard"}};
_styles = new List(10);
_headScripts = new List(10);
@@ -37,7 +31,7 @@ namespace Orchard.UI.Resources {
if (string.IsNullOrEmpty(fileName))
return;
- FileRegistrationContext context = new FileRegistrationContext(html.ViewContext, html.ViewDataContainer, fileName);
+ var context = new FileRegistrationContext(html.ViewContext, html.ViewDataContainer, fileName);
if (!_styles.Contains(context))
_styles.Add(context);
@@ -47,7 +41,7 @@ namespace Orchard.UI.Resources {
if (string.IsNullOrEmpty(fileName))
return;
- FileRegistrationContext context = new FileRegistrationContext(html.ViewContext, html.ViewDataContainer, fileName);
+ var context = new FileRegistrationContext(html.ViewContext, html.ViewDataContainer, fileName);
if (!_headScripts.Contains(context))
_headScripts.Add(context);
@@ -57,7 +51,7 @@ namespace Orchard.UI.Resources {
if (string.IsNullOrEmpty(fileName))
return;
- FileRegistrationContext context = new FileRegistrationContext(html.ViewContext, html.ViewDataContainer, fileName);
+ var context = new FileRegistrationContext(html.ViewContext, html.ViewDataContainer, fileName);
if (!_footScripts.Contains(context))
_footScripts.Add(context);
@@ -66,7 +60,7 @@ namespace Orchard.UI.Resources {
public MvcHtmlString GetMetas() {
return
MvcHtmlString.Create(string.Join("\r\n",
- _metas.Select(m => string.Format(MetaFormat, m.Key, m.Value)).ToArray()));
+ _metas.Select(m => string.Format(MetaFormat, m.Key, m.Value)).Reverse().ToArray()));
}
public MvcHtmlString GetStyles() {
@@ -84,20 +78,7 @@ namespace Orchard.UI.Resources {
private static MvcHtmlString GetFiles(IEnumerable fileRegistrationContexts, string fileFormat, string containerRelativePath) {
return
MvcHtmlString.Create(string.Join("\r\n",
- fileRegistrationContexts.Select(c => string.Format(fileFormat, c.GetFilePath(containerRelativePath))).ToArray()));
+ fileRegistrationContexts.Select(c => string.Format(fileFormat, c.GetFilePath(containerRelativePath))).Reverse().ToArray()));
}
-
- //TODO: (erikpo) Old code that may be needed later
- //private string GetThemePath(string fileName, RequestContext requestContext) {
- // var requestTheme = _themeService.GetRequestTheme(requestContext); // <- todo: (erikpo) will need context eventually
-
- // if (requestTheme == null)
- // return fileName;
-
- // //todo: (erikpo) this might be the worst code ever so resolve for real
- // return (_extensionManager.GetThemeLocation(requestTheme) + fileName)
- // .Replace("~", "")
- // .Replace("\\", "/");
- //}
}
}
\ No newline at end of file