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:
@@ -48,7 +48,7 @@ namespace Orchard.ContentManagement {
|
||||
itemShape.Metadata.DisplayType = actualDisplayType;
|
||||
|
||||
var context = new BuildDisplayContext(itemShape, content, actualDisplayType, _shapeFactory);
|
||||
BindPlacement(context, actualDisplayType);
|
||||
BindPlacement(context, actualDisplayType, stereotype);
|
||||
|
||||
_handlers.Value.Invoke(handler => handler.BuildDisplay(context), Logger);
|
||||
return context.Shape;
|
||||
@@ -66,7 +66,7 @@ namespace Orchard.ContentManagement {
|
||||
itemShape.ContentItem = content.ContentItem;
|
||||
|
||||
var context = new BuildEditorContext(itemShape, content, groupInfoId, _shapeFactory);
|
||||
BindPlacement(context, null);
|
||||
BindPlacement(context, null, stereotype);
|
||||
|
||||
_handlers.Value.Invoke(handler => handler.BuildEditor(context), Logger);
|
||||
|
||||
@@ -85,7 +85,7 @@ namespace Orchard.ContentManagement {
|
||||
itemShape.ContentItem = content.ContentItem;
|
||||
|
||||
var context = new UpdateEditorContext(itemShape, content, updater, groupInfoId, _shapeFactory);
|
||||
BindPlacement(context, null);
|
||||
BindPlacement(context, null, stereotype);
|
||||
|
||||
_handlers.Value.Invoke(handler => handler.UpdateEditor(context), Logger);
|
||||
|
||||
@@ -97,7 +97,7 @@ namespace Orchard.ContentManagement {
|
||||
return _shapeFactory.Create(actualShapeType, Arguments.Empty(), new[] { zoneHoldingBehavior });
|
||||
}
|
||||
|
||||
private void BindPlacement(BuildShapeContext context, string displayType) {
|
||||
private void BindPlacement(BuildShapeContext context, string displayType, string stereotype) {
|
||||
context.FindPlacement = (partShapeType, differentiator, defaultLocation) => {
|
||||
|
||||
var theme = _themeService.Value.GetRequestTheme(_requestContext);
|
||||
@@ -108,6 +108,7 @@ namespace Orchard.ContentManagement {
|
||||
if (shapeTable.Descriptors.TryGetValue(partShapeType, out descriptor)) {
|
||||
var placementContext = new ShapePlacementContext {
|
||||
ContentType = context.ContentItem.ContentType,
|
||||
Stereotype = stereotype,
|
||||
DisplayType = displayType,
|
||||
Differentiator = differentiator,
|
||||
Path = VirtualPathUtility.AppendTrailingSlash(VirtualPathUtility.ToAppRelative(request.Path)) // get the current app-relative path, i.e. ~/my-blog/foo
|
||||
|
@@ -109,6 +109,7 @@ namespace Orchard.DisplayManagement.Descriptors {
|
||||
|
||||
public class ShapePlacementContext {
|
||||
public string ContentType { get; set; }
|
||||
public string Stereotype { get; set; }
|
||||
public string DisplayType { get; set; }
|
||||
public string Differentiator { get; set; }
|
||||
public string Path { get; set; }
|
||||
|
@@ -98,9 +98,9 @@ namespace Orchard.DisplayManagement.Descriptors.ShapePlacementStrategy {
|
||||
case "ContentType":
|
||||
if (expression.EndsWith("*")) {
|
||||
var prefix = expression.Substring(0, expression.Length - 1);
|
||||
return ctx => (ctx.ContentType ?? "").StartsWith(prefix) && predicate(ctx);
|
||||
return ctx => ((ctx.ContentType ?? "").StartsWith(prefix) || (ctx.Stereotype ?? "").StartsWith(prefix)) && predicate(ctx);
|
||||
}
|
||||
return ctx => (ctx.ContentType == expression) && predicate(ctx);
|
||||
return ctx => ((ctx.ContentType == expression) || (ctx.Stereotype == expression)) && predicate(ctx);
|
||||
case "DisplayType":
|
||||
if (expression.EndsWith("*")) {
|
||||
var prefix = expression.Substring(0, expression.Length - 1);
|
||||
|
Reference in New Issue
Block a user