From b33d6081d3435eb8cf4b160c3b0089066eaaf6e3 Mon Sep 17 00:00:00 2001 From: Sebastien Ros Date: Fri, 5 Oct 2012 12:39:35 -0700 Subject: [PATCH] #19070: Showing the correct template in Shape Tracing for url alternates Url alternates where created using Metadata.Displaying instead of Shape.Displaying thus making alternates too late in the pipeline to be processed by Shape Tracing. Work Item: 19070 --HG-- branch : 1.x --- .../Services/UrlAlternatesFactory.cs | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/src/Orchard.Web/Modules/Orchard.DesignerTools/Services/UrlAlternatesFactory.cs b/src/Orchard.Web/Modules/Orchard.DesignerTools/Services/UrlAlternatesFactory.cs index f7704d814..18cf43f96 100644 --- a/src/Orchard.Web/Modules/Orchard.DesignerTools/Services/UrlAlternatesFactory.cs +++ b/src/Orchard.Web/Modules/Orchard.DesignerTools/Services/UrlAlternatesFactory.cs @@ -45,27 +45,24 @@ namespace Orchard.DesignerTools.Services { public override void Displaying(ShapeDisplayingContext context) { - context.ShapeMetadata.OnDisplaying(displayedContext => { - if (_urlAlternates.Value == null || !_urlAlternates.Value.Any()) { return; } // prevent applying alternate again, c.f. http://orchard.codeplex.com/workitem/18298 - if(displayedContext.ShapeMetadata.Alternates.Any(x => x.Contains("__url__"))) { + if (context.ShapeMetadata.Alternates.Any(x => x.Contains("__url__"))) { return; } // appends Url alternates to current ones - displayedContext.ShapeMetadata.Alternates = displayedContext.ShapeMetadata.Alternates.SelectMany( + context.ShapeMetadata.Alternates = context.ShapeMetadata.Alternates.SelectMany( alternate => new [] { alternate }.Union(_urlAlternates.Value.Select(a => alternate + "__url__" + a)) ).ToList(); // appends [ShapeType]__url__[Url] alternates - displayedContext.ShapeMetadata.Alternates = _urlAlternates.Value.Select(url => displayedContext.ShapeMetadata.Type + "__url__" + url) - .Union(displayedContext.ShapeMetadata.Alternates) + context.ShapeMetadata.Alternates = _urlAlternates.Value.Select(url => context.ShapeMetadata.Type + "__url__" + url) + .Union(context.ShapeMetadata.Alternates) .ToList(); - }); } }