From b639d893c0be5bf8c29dee6a3aa765dfdcf7e7ec Mon Sep 17 00:00:00 2001 From: Sipke Schoorstra Date: Tue, 21 Apr 2015 23:08:29 +0200 Subject: [PATCH] Work on selectable container elements. --- src/Orchard.Web/Modules/Orchard.DynamicForms/Scripts/Forms.js | 4 ++++ .../Modules/Orchard.DynamicForms/Scripts/Forms.min.js | 2 +- .../Orchard.DynamicForms/Scripts/Layouts/Models/Form.js | 4 ++++ src/Orchard.Web/Modules/Orchard.Layouts/Scripts/Models.js | 4 ++-- .../Modules/Orchard.Layouts/Scripts/Models/Canvas.js | 2 +- .../Modules/Orchard.Layouts/Scripts/Models/Column.js | 2 +- 6 files changed, 13 insertions(+), 5 deletions(-) diff --git a/src/Orchard.Web/Modules/Orchard.DynamicForms/Scripts/Forms.js b/src/Orchard.Web/Modules/Orchard.DynamicForms/Scripts/Forms.js index da6d36d90..a8a9175a6 100644 --- a/src/Orchard.Web/Modules/Orchard.DynamicForms/Scripts/Forms.js +++ b/src/Orchard.Web/Modules/Orchard.DynamicForms/Scripts/Forms.js @@ -62,6 +62,10 @@ var LayoutEditor; }); } + this.allowSealedFocus = function () { + return this.children.length === 0; + }; + this.setChildren = function (children) { this.children = children; _(this.children).each(function (child) { diff --git a/src/Orchard.Web/Modules/Orchard.DynamicForms/Scripts/Forms.min.js b/src/Orchard.Web/Modules/Orchard.DynamicForms/Scripts/Forms.min.js index 14ac67c5a..e78edeb4c 100644 --- a/src/Orchard.Web/Modules/Orchard.DynamicForms/Scripts/Forms.min.js +++ b/src/Orchard.Web/Modules/Orchard.DynamicForms/Scripts/Forms.min.js @@ -1 +1 @@ -angular.module("LayoutEditor").directive("orcLayoutForm",["$compile","scopeConfigurator","environment",function(n,t,i){return{restrict:"E",scope:{element:"="},controller:["$scope","$element",function(n,i){t.configureForElement(n,i);t.configureForContainer(n,i);n.sortableOptions.axis="y";n.edit=function(){n.$root.editElement(n.element).then(function(t){t.cancel||(n.element.data=decodeURIComponent(t.element.data),n.element.name=t.elementEditorModel.name,n.element.formBindingContentType=t.elementEditorModel.formBindingContentType,n.$apply())})}}],templateUrl:i.templateUrl("Form"),replace:!0}}]);var LayoutEditor;(function(n,t){t.Form=function(i,r,u,f,e,o,s,h,c,l,a,v,y){var p,w;t.Element.call(this,"Form",i,r,u,f,e,v);t.Container.call(this,["Grid","Content"],y);p=this;this.isContainable=!0;this.dropTargetClass="layout-common-holder";this.contentType=h;this.contentTypeLabel=c;this.contentTypeClass=l;this.name=o||"Untitled";this.formBindingContentType=s;this.hasEditor=a;this.toObject=function(){var n=this.elementToObject();return n.name=this.name,n.formBindingContentType=this.formBindingContentType,n.children=this.childrenToObject(),n};w=this.getEditorObject;this.getEditorObject=function(){var t=w();return n.extend(t,{FormName:this.name,FormBindingContentType:this.formBindingContentType})};this.setChildren=function(n){this.children=n;_(this.children).each(function(n){n.parent=p;p.linkChild(n)})};this.linkChild=function(t){var i=t.getEditorObject;t.getEditorObject=function(){var t=i();return n.extend(t,{FormBindingContentType:p.formBindingContentType})}};this.setChildren(y)};t.Form.from=function(n){return new t.Form(n.data,n.htmlId,n.htmlClass,n.htmlStyle,n.isTemplated,n.name,n.formBindingContentType,n.contentType,n.contentTypeLabel,n.contentTypeClass,n.hasEditor,n.rule,t.childrenFrom(n.children))};t.registerFactory("Form",function(n){return t.Form.from(n)})})(jQuery,LayoutEditor||(LayoutEditor={})); \ No newline at end of file +angular.module("LayoutEditor").directive("orcLayoutForm",["$compile","scopeConfigurator","environment",function(n,t,i){return{restrict:"E",scope:{element:"="},controller:["$scope","$element",function(n,i){t.configureForElement(n,i);t.configureForContainer(n,i);n.sortableOptions.axis="y";n.edit=function(){n.$root.editElement(n.element).then(function(t){t.cancel||(n.element.data=decodeURIComponent(t.element.data),n.element.name=t.elementEditorModel.name,n.element.formBindingContentType=t.elementEditorModel.formBindingContentType,n.$apply())})}}],templateUrl:i.templateUrl("Form"),replace:!0}}]);var LayoutEditor;(function(n,t){t.Form=function(i,r,u,f,e,o,s,h,c,l,a,v,y){var p,w;t.Element.call(this,"Form",i,r,u,f,e,v);t.Container.call(this,["Grid","Content"],y);p=this;this.isContainable=!0;this.dropTargetClass="layout-common-holder";this.contentType=h;this.contentTypeLabel=c;this.contentTypeClass=l;this.name=o||"Untitled";this.formBindingContentType=s;this.hasEditor=a;this.toObject=function(){var n=this.elementToObject();return n.name=this.name,n.formBindingContentType=this.formBindingContentType,n.children=this.childrenToObject(),n};w=this.getEditorObject;this.getEditorObject=function(){var t=w();return n.extend(t,{FormName:this.name,FormBindingContentType:this.formBindingContentType})};this.allowSealedFocus=function(){return this.children.length===0};this.setChildren=function(n){this.children=n;_(this.children).each(function(n){n.parent=p;p.linkChild(n)})};this.linkChild=function(t){var i=t.getEditorObject;t.getEditorObject=function(){var t=i();return n.extend(t,{FormBindingContentType:p.formBindingContentType})}};this.setChildren(y)};t.Form.from=function(n){return new t.Form(n.data,n.htmlId,n.htmlClass,n.htmlStyle,n.isTemplated,n.name,n.formBindingContentType,n.contentType,n.contentTypeLabel,n.contentTypeClass,n.hasEditor,n.rule,t.childrenFrom(n.children))};t.registerFactory("Form",function(n){return t.Form.from(n)})})(jQuery,LayoutEditor||(LayoutEditor={})); \ No newline at end of file diff --git a/src/Orchard.Web/Modules/Orchard.DynamicForms/Scripts/Layouts/Models/Form.js b/src/Orchard.Web/Modules/Orchard.DynamicForms/Scripts/Layouts/Models/Form.js index 564853032..ad3670f95 100644 --- a/src/Orchard.Web/Modules/Orchard.DynamicForms/Scripts/Layouts/Models/Form.js +++ b/src/Orchard.Web/Modules/Orchard.DynamicForms/Scripts/Layouts/Models/Form.js @@ -33,6 +33,10 @@ }); } + this.allowSealedFocus = function () { + return this.children.length === 0; + }; + this.setChildren = function (children) { this.children = children; _(this.children).each(function (child) { diff --git a/src/Orchard.Web/Modules/Orchard.Layouts/Scripts/Models.js b/src/Orchard.Web/Modules/Orchard.Layouts/Scripts/Models.js index 05a8ffcfa..5c8c58159 100644 --- a/src/Orchard.Web/Modules/Orchard.Layouts/Scripts/Models.js +++ b/src/Orchard.Web/Modules/Orchard.Layouts/Scripts/Models.js @@ -406,7 +406,7 @@ var LayoutEditor; this.allowSealedFocus = function() { return this.children.length === 0; - } + }; }; LayoutEditor.Canvas.from = function (value) { @@ -759,7 +759,7 @@ var LayoutEditor; this.allowSealedFocus = function () { return this.children.length === 0; - } + }; this.beginChange = function () { if (!!_hasPendingChange) diff --git a/src/Orchard.Web/Modules/Orchard.Layouts/Scripts/Models/Canvas.js b/src/Orchard.Web/Modules/Orchard.Layouts/Scripts/Models/Canvas.js index cb87fcdf4..77e96ff36 100644 --- a/src/Orchard.Web/Modules/Orchard.Layouts/Scripts/Models/Canvas.js +++ b/src/Orchard.Web/Modules/Orchard.Layouts/Scripts/Models/Canvas.js @@ -13,7 +13,7 @@ this.allowSealedFocus = function() { return this.children.length === 0; - } + }; }; LayoutEditor.Canvas.from = function (value) { diff --git a/src/Orchard.Web/Modules/Orchard.Layouts/Scripts/Models/Column.js b/src/Orchard.Web/Modules/Orchard.Layouts/Scripts/Models/Column.js index 18ba5febc..3131194a8 100644 --- a/src/Orchard.Web/Modules/Orchard.Layouts/Scripts/Models/Column.js +++ b/src/Orchard.Web/Modules/Orchard.Layouts/Scripts/Models/Column.js @@ -13,7 +13,7 @@ this.allowSealedFocus = function () { return this.children.length === 0; - } + }; this.beginChange = function () { if (!!_hasPendingChange)