Skip to content

Commit

Permalink
Some fixes for the inputEx plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
ericabouaf committed Aug 29, 2010
1 parent 8680361 commit 65f82a2
Show file tree
Hide file tree
Showing 3 changed files with 84 additions and 0 deletions.
24 changes: 24 additions & 0 deletions plugins/inputex/js/TextareaContainer.js
@@ -0,0 +1,24 @@
/**
* Form container for a single textarea field which is resizeable.
* Important: this class takes the exact same arguments as the FormContainer !
* You still need to specify the "fields".
* @class WireIt.TextareaContainer
* @extends WireIt.FormContainer
* @constructor
* @param {Object} options Configuration object (see properties)
* @param {WireIt.Layer} layer The WireIt.Layer (or subclass) instance that contains this container
*/
WireIt.TextareaContainer = function(options, layer) {

WireIt.TextareaContainer.superclass.constructor.call(this, options, layer);

this.ddResize.eventResize.subscribe(function(e, args) {
var el = this.form.inputs[0].el;
YAHOO.util.Dom.setStyle(el, "height", (args[0][1]-48)+"px");
YAHOO.util.Dom.setStyle(el, "width", (args[0][0]-17)+"px");
}, this, true);
};

YAHOO.extend(WireIt.TextareaContainer, WireIt.FormContainer, {

});
57 changes: 57 additions & 0 deletions plugins/inputex/js/fields.js
@@ -0,0 +1,57 @@
// this file ovveride many functions on inputEx fields to make them wirable

/**
* setFieldName might change the name of the terminal
*/
inputEx.StringField.prototype.setFieldName = function(name) {
this.el.name = name;
if(this.terminal) {
this.terminal.name = name;
this.terminal.el.title = name;
}
};


/**
* Groups must set the container recursively
*/
inputEx.Group.prototype.setContainer = function(container) {

inputEx.Group.superclass.setContainer.call(this, container);

// Group and inherited fields must set this recursively
if(this.inputs) {
for(var i = 0 ; i < this.inputs.length ; i++) {
this.inputs[i].setContainer(container);
}
}

};


/**
* List must set the container recursively
*/
inputEx.ListField.prototype.setContainer = function(container) {

inputEx.ListField.superclass.setContainer.call(this, container);

if(this.subFields) {
for(var i = 0 ; i < this.subFields.length ; i++) {
this.subFields[i].setContainer(container);
}
}

};

/**
* setContainer must be called on each new element
*/
inputEx.ListField.prototype._addElement = inputEx.ListField.prototype.addElement;
inputEx.ListField.prototype.addElement = function(value) {
var f = this._addElement(value);
f.setContainer(this.options.container);
return f;
};


3 changes: 3 additions & 0 deletions plugins/layer-container/README.md
@@ -0,0 +1,3 @@


Will require a special getWiring method which handles LayerContainers

0 comments on commit 65f82a2

Please sign in to comment.