mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2025-10-15 19:54:57 +08:00
Merge
--HG-- branch : dev
This commit is contained in:
@@ -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]-->");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -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);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user