Layout Canvas reusability improvements.

This enables child canvas elements to be moved around and removed.
This commit is contained in:
Sipke Schoorstra
2015-04-30 17:35:03 +02:00
parent ff461b3945
commit a919aab936
5 changed files with 19 additions and 4 deletions

View File

@@ -193,6 +193,10 @@ var LayoutEditor;
this.editor.dropTargetElement = null;
};
this.canDelete = function () {
return !!this.parent;
};
this.delete = function () {
if (!!this.parent)
this.parent.deleteChild(this);
@@ -396,7 +400,9 @@ var LayoutEditor;
LayoutEditor.Canvas = function (data, htmlId, htmlClass, htmlStyle, isTemplated, rule, children) {
LayoutEditor.Element.call(this, "Canvas", data, htmlId, htmlClass, htmlStyle, isTemplated, rule);
LayoutEditor.Container.call(this, ["Grid", "Content"], children);
LayoutEditor.Container.call(this, ["Canvas", "Grid", "Content"], children);
this.isContainable = true;
this.toObject = function () {
var result = this.elementToObject();

File diff suppressed because one or more lines are too long

View File

@@ -3,7 +3,9 @@
LayoutEditor.Canvas = function (data, htmlId, htmlClass, htmlStyle, isTemplated, rule, children) {
LayoutEditor.Element.call(this, "Canvas", data, htmlId, htmlClass, htmlStyle, isTemplated, rule);
LayoutEditor.Container.call(this, ["Grid", "Content"], children);
LayoutEditor.Container.call(this, ["Canvas", "Grid", "Content"], children);
this.isContainable = true;
this.toObject = function () {
var result = this.elementToObject();

View File

@@ -117,6 +117,10 @@
this.editor.dropTargetElement = null;
};
this.canDelete = function () {
return !!this.parent;
};
this.delete = function () {
if (!!this.parent)
this.parent.deleteChild(this);

View File

@@ -1,8 +1,11 @@
<div class="layout-element-wrapper" ng-class="{'layout-container-empty': getShowChildrenPlaceholder()}">
<ul class="layout-panel layout-panel-main">
<li class="layout-panel-item layout-panel-label">Canvas</li>
<li class="layout-panel-item layout-panel-label">@T("Canvas")</li>
@Display()
@Display(New.LayoutEditor_Template_Properties(ElementTypeName: "canvas"))
<li class="layout-panel-item layout-panel-action" title="@T("Delete canvas (Del)")" ng-click="delete(element)" ng-show="element.canDelete()"><i class="fa fa-remove"></i></li>
<li class="layout-panel-item layout-panel-action" title="@T("Move canvas up (Ctrl+Up)")" ng-click="element.moveUp()" ng-show="element.canMoveUp()"><i class="fa fa-chevron-up"></i></li>
<li class="layout-panel-item layout-panel-action" title="@T("Move canvas down (Ctrl+Down)")" ng-click="element.moveDown()" ng-show="element.canMoveDown()"><i class="fa fa-chevron-down"></i></li>
</ul>
<div class="layout-container-children-placeholder">
@T("This layout canvas is empty. To get started, drag a grid element from the toolbox and drop it here.")