webui: widget initialization

- used `ctor_init` instead of `init` to avoid name collision with
  existing logic
- `ctor_init` is called right after widget instantiation. Basically support
  better inheritance for the old class system which doesn't have proper
  contructors

https://fedorahosted.org/freeipa/ticket/4402

Reviewed-By: Endi Sukma Dewata <edewata@redhat.com>
This commit is contained in:
Petr Vobornik 2014-07-28 18:06:45 +02:00
parent 01a8175119
commit 1f13e56ac6

View File

@ -212,6 +212,14 @@ IPA.widget = function(spec) {
that.clear = function() {
};
/**
* Widget post constructor/factory initialization
*
* Called by builder by default.
*/
that.ctor_init = function() {
};
/**
* Set enabled state.
* @param {boolean} value - True - enabled; False - disabled
@ -5998,6 +6006,7 @@ exp.post_op = function(obj, spec, context) {
nc.container = obj.widgets;
builder.build('widget', spec.widgets, nc);
}
if (obj.ctor_init) obj.ctor_init();
return obj;
};