diff --git a/src/Orchard.Web/Modules/Orchard.DesignerTools/Orchard.DesignerTools.csproj b/src/Orchard.Web/Modules/Orchard.DesignerTools/Orchard.DesignerTools.csproj index 3d05e64c9..c7f910fc7 100644 --- a/src/Orchard.Web/Modules/Orchard.DesignerTools/Orchard.DesignerTools.csproj +++ b/src/Orchard.Web/Modules/Orchard.DesignerTools/Orchard.DesignerTools.csproj @@ -72,8 +72,11 @@ + + + Designer 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 4c19ec4b1..33f7ac31d 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,17 +1,67 @@ (function ($) { $(function () { // append the shape tracing window container at the end of the document - $('
toolbar
window
').appendTo('body'); + $( '
' + + '
' + + '
' + + '
' + + '
' + + '
window
' + + '
' + + '
' + ).appendTo('body'); // preload main objects var shapeTracingContainer = $('#shape-tracing-container'); var shapeTracingToolbar = $('#shape-tracing-toolbar'); + var shapeTracingToolbarSwitch = $('#shape-tracing-toolbar-switch'); var shapeTracingWindow = $('#shape-tracing-window'); var shapeTracingGhost = $('#shape-tracing-container-ghost'); + // store the size of the container when it is closed (default in css) + var initialContainerSize = shapeTracingContainer.height(); + var previousSize = 0; + // ensure the ghost has always the same size as the container - shapeTracingContainer.resize(function () { shapeTracingGhost.height(shapeTracingContainer.height()); }); - shapeTracingContainer.trigger('resize'); + // and the container is always positionned correctly + var syncResize = function () { + var _window = $(window); + var containerHeight = shapeTracingContainer.height(); + var windowHeight = _window.height(); + var scrollTop = _window.scrollTop(); + + shapeTracingGhost.height(containerHeight); + shapeTracingContainer.offset({ top: windowHeight - containerHeight + scrollTop, left: 0 }); + shapeTracingContainer.width('100%'); + }; + + // ensure the size/position is correct whenver the container or the browser is resized + shapeTracingContainer.resize(syncResize); + $(window).resize(syncResize); + $(window).resize(); + + // removes the position flickering by hiding it first, then showing when ready + shapeTracingContainer.show(); + + // expand/collapse behavior + // ensure the container has always a valid size when expanded + shapeTracingToolbarSwitch.click(function () { + var _this = $(this); + _this.toggleClass('expanded'); + if (_this.hasClass('expanded')) { + shapeTracingContainer.height(Math.max(previousSize, 100)); + } + else { + // save previous height + previousSize = shapeTracingContainer.height(); + shapeTracingContainer.height(initialContainerSize); + } + syncResize(); + }); + + // add a resizable handle to the container + $('#shape-tracing-resize-handle').addClass('ui-resizable-handle ui-resizable-n'); + shapeTracingContainer.resizable({ handles: { n: '#shape-tracing-resize-handle'} }); }); })(jQuery); diff --git a/src/Orchard.Web/Modules/Orchard.DesignerTools/Styles/Images/close.png b/src/Orchard.Web/Modules/Orchard.DesignerTools/Styles/Images/close.png new file mode 100644 index 000000000..ccb13672a Binary files /dev/null and b/src/Orchard.Web/Modules/Orchard.DesignerTools/Styles/Images/close.png differ diff --git a/src/Orchard.Web/Modules/Orchard.DesignerTools/Styles/Images/collapse.png b/src/Orchard.Web/Modules/Orchard.DesignerTools/Styles/Images/collapse.png new file mode 100644 index 000000000..609b4f62f Binary files /dev/null and b/src/Orchard.Web/Modules/Orchard.DesignerTools/Styles/Images/collapse.png differ diff --git a/src/Orchard.Web/Modules/Orchard.DesignerTools/Styles/Images/expand.png b/src/Orchard.Web/Modules/Orchard.DesignerTools/Styles/Images/expand.png new file mode 100644 index 000000000..aba719028 Binary files /dev/null and b/src/Orchard.Web/Modules/Orchard.DesignerTools/Styles/Images/expand.png differ diff --git a/src/Orchard.Web/Modules/Orchard.DesignerTools/Styles/Images/toolbar-bg.png b/src/Orchard.Web/Modules/Orchard.DesignerTools/Styles/Images/toolbar-bg.png new file mode 100644 index 000000000..a88fcbc2d Binary files /dev/null and b/src/Orchard.Web/Modules/Orchard.DesignerTools/Styles/Images/toolbar-bg.png differ 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 f8eec7cf1..efe1446df 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 @@ -7,24 +7,39 @@ display:block; font-size:10pt; font-family:Segoe; - margin-top:5px; left: 0px; bottom: 0px; position:fixed; z-index:999; width:100%; - height:100px; + display:none; + max-height:66%; + height:24px; /* handle + toolbar */ + min-height:24px; } #shape-tracing-toolbar { - color:white; - background-color: #1D1A1A; - height:16px; - padding: 2px 0px 2px 0px; + color:black; + background: url(images/toolbar-bg.png) repeat-x; + height:17px; + padding-top:4px; /* total size 21px = height + padding */ + padding-left:5px; + padding-right:5px; +} + +#shape-tracing-toolbar-switch { + display:block; + float:right; + width:14px; + height:100%; + background: url(images/expand.png) no-repeat; +} + +#shape-tracing-toolbar-switch.expanded { + background: url(images/collapse.png) no-repeat; } #shape-tracing-window { - color:white; background-color: #343131; height:100%; } @@ -37,4 +52,11 @@ width:100%; display:block; } - + +#shape-tracing-resize-handle { + width:100%; + display:block; + height:5px; + background-color:transparent; + cursor:n-resize; +} \ No newline at end of file diff --git a/src/Orchard.Web/Modules/Orchard.DesignerTools/Views/ShapeTracingWrapper.cshtml b/src/Orchard.Web/Modules/Orchard.DesignerTools/Views/ShapeTracingWrapper.cshtml index c42a0ca8d..521c57166 100644 --- a/src/Orchard.Web/Modules/Orchard.DesignerTools/Views/ShapeTracingWrapper.cshtml +++ b/src/Orchard.Web/Modules/Orchard.DesignerTools/Views/ShapeTracingWrapper.cshtml @@ -4,9 +4,10 @@ @using System.Xml; @{ - Script.Require("jQueryUI_Tabs"); - Script.Include("orchard-designertools-shapetracing.js"); - Style.Include("orchard-designertools-shapetracing.css"); + Script.Require("jQueryUI_Tabs").AtHead(); + Script.Require("jQueryUI_Resizable").AtHead(); + Script.Include("orchard-designertools-shapetracing.js").AtHead(); + Style.Include("orchard-designertools-shapetracing.css").AtHead(); // Code Mirror Script.Include("CodeMirror/codemirror.js"); @@ -20,7 +21,7 @@ Script.Include("CodeMirror/htmlmixed.js"); } -
+
@Display(Model.Metadata.ChildContent) @{ Layout.Zones["Tail"].Add(