#21226: Fixed that the Bindings tab doesn't appear for newly added form fields.

Work Item: 21226
This commit is contained in:
Sipke Schoorstra
2015-02-27 10:31:50 +01:00
parent 7cab0bcf07
commit e26d70f3a5
9 changed files with 43 additions and 21 deletions

View File

@@ -62,17 +62,20 @@ var LayoutEditor;
this.children = children;
_(this.children).each(function (child) {
child.parent = self;
var getEditorObject = child.getEditorObject;
child.getEditorObject = function () {
var dto = getEditorObject();
return $.extend(dto, {
FormBindingContentType: self.formBindingContentType
});
};
self.linkChild(child);
});
};
this.linkChild = function(element) {
var getEditorObject = element.getEditorObject;
element.getEditorObject = function () {
var dto = getEditorObject();
return $.extend(dto, {
FormBindingContentType: self.formBindingContentType
});
};
};
this.setChildren(children);
};

View File

@@ -1 +1 @@
angular.module("LayoutEditor").directive("orcLayoutForm",function(n,t,i){return{restrict:"E",scope:{element:"="},controller: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){var y,p;t.Element.call(this,"Form",i,r,u,f,e);t.Container.call(this,["Grid","Content"],v);y=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};p=this.getEditorObject;this.getEditorObject=function(){var t=p();return n.extend(t,{FormName:this.name,FormBindingContentType:this.formBindingContentType})};this.setChildren=function(t){this.children=t;_(this.children).each(function(t){t.parent=y;var i=t.getEditorObject;t.getEditorObject=function(){var t=i();return n.extend(t,{FormBindingContentType:y.formBindingContentType})}})};this.setChildren(v)};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,t.childrenFrom(n.children))};t.registerFactory("Form",function(n){return t.Form.from(n)})})(jQuery,LayoutEditor||(LayoutEditor={}));
angular.module("LayoutEditor").directive("orcLayoutForm",function(n,t,i){return{restrict:"E",scope:{element:"="},controller: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){var y,p;t.Element.call(this,"Form",i,r,u,f,e);t.Container.call(this,["Grid","Content"],v);y=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};p=this.getEditorObject;this.getEditorObject=function(){var t=p();return n.extend(t,{FormName:this.name,FormBindingContentType:this.formBindingContentType})};this.setChildren=function(n){this.children=n;_(this.children).each(function(n){n.parent=y;y.linkChild(n)})};this.linkChild=function(t){var i=t.getEditorObject;t.getEditorObject=function(){var t=i();return n.extend(t,{FormBindingContentType:y.formBindingContentType})}};this.setChildren(v)};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,t.childrenFrom(n.children))};t.registerFactory("Form",function(n){return t.Form.from(n)})})(jQuery,LayoutEditor||(LayoutEditor={}));

View File

@@ -37,17 +37,20 @@
this.children = children;
_(this.children).each(function (child) {
child.parent = self;
var getEditorObject = child.getEditorObject;
child.getEditorObject = function () {
var dto = getEditorObject();
return $.extend(dto, {
FormBindingContentType: self.formBindingContentType
});
};
self.linkChild(child);
});
};
this.linkChild = function(element) {
var getEditorObject = element.getEditorObject;
element.getEditorObject = function () {
var dto = getEditorObject();
return $.extend(dto, {
FormBindingContentType: self.formBindingContentType
});
};
};
this.setChildren(children);
};

View File

@@ -264,8 +264,9 @@ angular
// Should ideally call LayoutEditor.Container.addChild() instead, but since this handler
// is run *before* the ui-sortable directive's handler, if we try to add the child to the
// array that handler will get an exception when trying to do the same.
// Because of this, we need to invoke "setParent" so that specific container types can perform element speficic initialization.
receivedElement.setEditor(element.editor);
receivedElement.parent = element;
receivedElement.setParent(element);
if (receivedElement.type == "Content" && !!receivedElement.hasEditor) {
$scope.$root.editElement(receivedElement).then(function (args) {
if (!args.cancel) {

File diff suppressed because one or more lines are too long

View File

@@ -233,8 +233,9 @@
// Should ideally call LayoutEditor.Container.addChild() instead, but since this handler
// is run *before* the ui-sortable directive's handler, if we try to add the child to the
// array that handler will get an exception when trying to do the same.
// Because of this, we need to invoke "setParent" so that specific container types can perform element speficic initialization.
receivedElement.setEditor(element.editor);
receivedElement.parent = element;
receivedElement.setParent(element);
if (receivedElement.type == "Content" && !!receivedElement.hasEditor) {
$scope.$root.editElement(receivedElement).then(function (args) {
if (!args.cancel) {

View File

@@ -100,6 +100,13 @@ var LayoutEditor;
}
};
this.setParent = function(parentElement) {
this.parent = parentElement;
if (!!this.parent.linkChild)
this.parent.linkChild(this);
};
this.setIsTemplated = function (value) {
this.isTemplated = value;
if (!!this.children && _.isArray(this.children)) {

File diff suppressed because one or more lines are too long

View File

@@ -25,6 +25,13 @@
}
};
this.setParent = function(parentElement) {
this.parent = parentElement;
if (!!this.parent.linkChild)
this.parent.linkChild(this);
};
this.setIsTemplated = function (value) {
this.isTemplated = value;
if (!!this.children && _.isArray(this.children)) {