diff --git a/src/Orchard.Web/Modules/Orchard.DesignerTools/Scripts/orchard-designertools-shapetracing.js b/src/Orchard.Web/Modules/Orchard.DesignerTools/Scripts/orchard-designertools-shapetracing.js index 46342546b..2d44b3e9d 100644 --- a/src/Orchard.Web/Modules/Orchard.DesignerTools/Scripts/orchard-designertools-shapetracing.js +++ b/src/Orchard.Web/Modules/Orchard.DesignerTools/Scripts/orchard-designertools-shapetracing.js @@ -1,23 +1,42 @@ -(function($) { - $(function() { - $("
»
") +(function ($) { + $(function () { + $("
»
") .appendTo("body"); - $("#debug-shape-templates").click(function () { + $("#debug-shapes").click(function () { var _this = $(this); $("html").toggleClass(_this.attr("id")); $(this).toggleClass("debug-active"); }); - $("#debug-shape-zones").click(function () { + $("#debug-zones").click(function () { var _this = $(this); $("html").toggleClass(_this.attr("id")); $(this).toggleClass("debug-active"); + + if ($(this).hasClass("debug-active")) { + + // renders the zone name in each zone + $(".zone").each(function () { + var classes = $(this).attr("class").split(' '); + + for (i = 0; i < classes.length; i++) { + if (classes[i].indexOf("zone-") === 0) { + $(this).append('
' + classes[i].substr(classes[i].indexOf("-")+1) + '
'); + } + } + + }); + } + else { + $(".zone-name").remove(); + } + }); $("#debug-control-toggle").click(function () { var _this = $(this), open = "debug-open"; - if (_this.is("."+open)) { - _this.prev().hide("fast", function() {_this.removeClass(open).html("»");}); + if (_this.is("." + open)) { + _this.prev().hide("fast", function () { _this.removeClass(open).html("»"); }); } else { - _this.prev().show("fast", function() {_this.addClass(open).html("«");}); + _this.prev().show("fast", function () { _this.addClass(open).html("«"); }); } }); }); diff --git a/src/Orchard.Web/Modules/Orchard.DesignerTools/Services/ShapeTracingFactory.cs b/src/Orchard.Web/Modules/Orchard.DesignerTools/Services/ShapeTracingFactory.cs index 63671340d..38fbe653d 100644 --- a/src/Orchard.Web/Modules/Orchard.DesignerTools/Services/ShapeTracingFactory.cs +++ b/src/Orchard.Web/Modules/Orchard.DesignerTools/Services/ShapeTracingFactory.cs @@ -8,9 +8,12 @@ namespace Orchard.DesignerTools.Services { } public void Created(ShapeCreatedContext context) { - if (context.ShapeType != "Layout" - && context.ShapeType != "DocumentZone" - ) { + if (context.ShapeType != "Layout" + && context.ShapeType != "DocumentZone" + && context.ShapeType != "PlaceChildContent" + && context.ShapeType != "ContentZone" + ) + { context.Shape.Metadata.Wrappers.Add("ShapeTracing_Wrapper"); } } diff --git a/src/Orchard.Web/Modules/Orchard.DesignerTools/Styles/orchard-designertools-shapetracing.css b/src/Orchard.Web/Modules/Orchard.DesignerTools/Styles/orchard-designertools-shapetracing.css index fc6a1fda1..1f66e6c95 100644 --- a/src/Orchard.Web/Modules/Orchard.DesignerTools/Styles/orchard-designertools-shapetracing.css +++ b/src/Orchard.Web/Modules/Orchard.DesignerTools/Styles/orchard-designertools-shapetracing.css @@ -37,13 +37,23 @@ border-right:1px solid #999; } -.debug-shape-templates .shape-tracing .wrapper { +.debug-shapes .shape-tracing .wrapper { background:#FFF; border:1px dotted #CA7230; - padding:2px; + margin:5px; + padding:0px; + display:inline-block; + + /* when there is nothing inside the shape, force to the size of the smart tag */ + min-width:20px; + min-height:20px; +} +.debug-shapes body +{ + margin-top:25px; } -.debug-shape-templates .shape-tracing .wrapper :hover { +.debug-shapes .shape-tracing .wrapper :hover { background:#E0E9EE; } @@ -51,7 +61,7 @@ display:none; } -.debug-shape-templates .shape-tracing .meta { +.debug-shapes .shape-tracing .meta { clear:both; display:block; background:#cfc; @@ -61,10 +71,21 @@ margin-top:5px; } -.debug-shape-zones .shape-tracing .wrapper .zone { - border:1px dotted red; +.debug-zones .Zone { + border:1px dashed grey; margin:5px; - padding:2px; + position: relative; +} + +.debug-zones .zone-name { + position:absolute; top: 0px; left: 0px; + display: block; background-color: #ddd; color: #434343; padding: 3px 6px; + filter:alpha(opacity=70); + opacity: 0.7; +} + +.debug-shapes .Zone :hover { + background:#E0E9EE; } .meta .shape { diff --git a/src/Orchard.Web/Modules/Orchard.DesignerTools/Views/ShapeTracing.Wrapper.cshtml b/src/Orchard.Web/Modules/Orchard.DesignerTools/Views/ShapeTracing.Wrapper.cshtml index 26c41b77c..e0f45bfdb 100644 --- a/src/Orchard.Web/Modules/Orchard.DesignerTools/Views/ShapeTracing.Wrapper.cshtml +++ b/src/Orchard.Web/Modules/Orchard.DesignerTools/Views/ShapeTracing.Wrapper.cshtml @@ -14,7 +14,7 @@ var descriptor = shapeTable.Descriptors[Model.Metadata.Type]; } @functions { - string FormatShape(string type, string themeId) { + string FormatShapeFilename(string type, string themeId) { return "~/Themes/" + themeId + "/Views/" + type.Replace("__", "-").Replace("_", ".") + ".cshtml"; } @@ -41,18 +41,19 @@
@foreach(var alternate in Model.Metadata.Alternates) { - var formatted = @FormatShape(alternate, workContext.CurrentTheme.Id); + var formatted = @FormatShapeFilename(alternate, workContext.CurrentTheme.Id);
@formatted
}
@foreach(var wrapper in Model.Metadata.Wrappers) { if(wrapper != "ShapeTracing_Wrapper") { -
@wrapper
+ var formatted = @FormatShapeFilename(wrapper, workContext.CurrentTheme.Id); +
@formatted
} }
-
+