8ed4fe7f019763a2a07bada3d9446bbf8dbcfb0b
[ccsdk/features.git] / sdnr / wt / devicemanager / provider / src / main / resources / elasticsearch / plugins / head / src / app / ui / panelForm / panelForm.js
1 (function( $, app ) {
2
3         var ui = app.ns("ui");
4         var ut = app.ns("ut");
5
6         ui.PanelForm = ui.AbstractWidget.extend({
7                 defaults: {
8                         fields: null    // (required) instanceof app.ux.FieldCollection
9                 },
10                 init: function(parent) {
11                         this._super();
12                         this.el = $.joey(this._main_template());
13                         this.attach( parent );
14                 },
15                 _main_template: function() {
16                         return { tag: "DIV", id: this.id(), cls: "uiPanelForm", children: this.config.fields.fields.map(this._field_template, this) };
17                 },
18                 _field_template: function(field) {
19                         return { tag: "LABEL", cls: "uiPanelForm-field", children: [
20                                 { tag: "DIV", cls: "uiPanelForm-label", children: [ field.label, ut.require_template(field) ] },
21                                 field
22                         ]};
23                 }
24         });
25
26 })( this.jQuery, this.app );