--HG--
branch : dev
This commit is contained in:
Dave Reed
2010-11-29 14:17:07 -08:00
2 changed files with 14 additions and 0 deletions

View File

@@ -225,7 +225,14 @@ namespace Orchard.Core.Shapes {
foreach (var context in requiredResources.Where(r =>
(includeLocation.HasValue ? r.Settings.Location == includeLocation.Value : true) &&
(excludeLocation.HasValue ? r.Settings.Location != excludeLocation.Value : true))) {
var condition = context.Settings.Condition;
if (!string.IsNullOrEmpty(condition)) {
html.ViewContext.Writer.WriteLine("<!--[if " + condition + "]>");
}
html.ViewContext.Writer.WriteLine(context.GetTagBuilder(defaultSettings, appPath).ToString(context.Resource.TagRenderMode));
if (!string.IsNullOrEmpty(condition)) {
html.ViewContext.Writer.WriteLine("<![endif]-->");
}
}
}

View File

@@ -9,6 +9,7 @@ namespace Orchard.UI.Resources {
public bool DebugMode { get; set; }
public bool CdnMode { get; set; }
public ResourceLocation Location { get; set; }
public string Condition { get; set; }
public Action<ResourceDefinition> InlineDefinition { get; set; }
public RequireSettings AtHead() {
@@ -55,6 +56,11 @@ namespace Orchard.UI.Resources {
return this;
}
public RequireSettings UseCondition(string condition) {
Condition = Condition ?? condition;
return this;
}
public RequireSettings Define(Action<ResourceDefinition> resourceDefinition) {
InlineDefinition = resourceDefinition ?? InlineDefinition;
return this;
@@ -69,6 +75,7 @@ namespace Orchard.UI.Resources {
.UseCdn(CdnMode).UseCdn(other.CdnMode)
.UseDebugMode(DebugMode).UseDebugMode(other.DebugMode)
.UseCulture(Culture).UseCulture(other.Culture)
.UseCondition(Condition).UseCondition(other.Condition)
.Define(InlineDefinition).Define(other.InlineDefinition);
}
}