From 43315c349fe3601a40d39af3c82f66adf9b671e6 Mon Sep 17 00:00:00 2001 From: Sergio Navarro Date: Tue, 14 Jul 2015 20:49:39 +0200 Subject: [PATCH] Update ShapePlacementParsingStrategy.cs --- .../ShapePlacementParsingStrategy.cs | 21 ++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/src/Orchard/DisplayManagement/Descriptors/ShapePlacementStrategy/ShapePlacementParsingStrategy.cs b/src/Orchard/DisplayManagement/Descriptors/ShapePlacementStrategy/ShapePlacementParsingStrategy.cs index 7f412f247..ff9894db0 100644 --- a/src/Orchard/DisplayManagement/Descriptors/ShapePlacementStrategy/ShapePlacementParsingStrategy.cs +++ b/src/Orchard/DisplayManagement/Descriptors/ShapePlacementStrategy/ShapePlacementParsingStrategy.cs @@ -107,13 +107,24 @@ namespace Orchard.DisplayManagement.Descriptors.ShapePlacementStrategy { } } - private void GetShapeType(PlacementShapeLocation shapeLocation, out string shapeType, out string differentiator) { + private void GetShapeType(PlacementShapeLocation shapeLocation, out string shapeType, out string differentiator) + { differentiator = ""; shapeType = shapeLocation.ShapeType; - var dashIndex = shapeType.LastIndexOf("__"); - if (dashIndex > 0 && dashIndex < shapeType.Length - 2) { - differentiator = shapeType.Substring(dashIndex + 2); - shapeType = shapeType.Substring(0, dashIndex); + var separatorLengh = 2; + var separatorIndex = shapeType.LastIndexOf("__"); + + var dashIndex = shapeType.LastIndexOf('-'); + if (dashIndex > separatorIndex) + { + separatorIndex = dashIndex; + separatorLengh = 1; + } + + if (separatorIndex > 0 && separatorIndex < shapeType.Length - separatorLengh) + { + differentiator = shapeType.Substring(separatorIndex + separatorLengh); + shapeType = shapeType.Substring(0, separatorIndex); } }