]> git.proxmox.com Git - proxmox-widget-toolkit.git/blobdiff - window/Edit.js
toolkit: remove PVE specific VType
[proxmox-widget-toolkit.git] / window / Edit.js
index f92c8dea1fce01eb1688c88bd34a64ae780629c7..0d5194447d88ed2c356c1d4bd1e6858b5bbf53ae 100644 (file)
@@ -13,9 +13,9 @@ Ext.define('Proxmox.window.Edit', {
     // Create: <subject>
     subject: undefined,
 
-    // set create to true if you want a Create button (instead
+    // set isCreate to true if you want a Create button (instead
     // OK and RESET)
-    create: false,
+    isCreate: false,
 
     // set to true if you want an Add button (instead of Create)
     isAdd: false,
@@ -38,6 +38,11 @@ Ext.define('Proxmox.window.Edit', {
 
     showProgress: false,
 
+    // assign a reference from docs, to add a help button docked to the
+    // bottom of the window. If undefined we magically fall back to the
+    // onlineHelp of our first item, if set.
+    onlineHelp: undefined,
+
     isValid: function() {
        var me = this;
 
@@ -198,6 +203,8 @@ Ext.define('Proxmox.window.Edit', {
            throw "no url specified";
        }
 
+       if (me.create) {throw "deprecated parameter, use isCreate";}
+
        var items = Ext.isArray(me.items) ? me.items : [ me.items ];
 
        me.items = undefined;
@@ -208,9 +215,9 @@ Ext.define('Proxmox.window.Edit', {
            trackResetOnLoad: true,
            bodyPadding: 10,
            border: false,
-           defaults: {
+           defaults: Ext.apply({}, me.defaults, {
                border: false
-           },
+           }),
            fieldDefaults: Ext.apply({}, me.fieldDefaults, {
                labelWidth: 100,
                anchor: '100%'
@@ -223,7 +230,7 @@ Ext.define('Proxmox.window.Edit', {
        var form = me.formPanel.getForm();
 
        var submitText;
-       if (me.create) {
+       if (me.isCreate) {
            if (me.submitText) {
                submitText = me.submitText;
            } else if (me.isAdd) {
@@ -240,7 +247,7 @@ Ext.define('Proxmox.window.Edit', {
        var submitBtn = Ext.create('Ext.Button', {
            reference: 'submitbutton',
            text: submitText,
-           disabled: !me.create,
+           disabled: !me.isCreate,
            handler: function() {
                me.submit();
            }
@@ -257,7 +264,7 @@ Ext.define('Proxmox.window.Edit', {
        var set_button_status = function() {
            var valid = form.isValid();
            var dirty = form.isDirty();
-           submitBtn.setDisabled(!valid || !(dirty || me.create));
+           submitBtn.setDisabled(!valid || !(dirty || me.isCreate));
            resetBtn.setDisabled(!dirty);
        };
 
@@ -273,10 +280,10 @@ Ext.define('Proxmox.window.Edit', {
            (inputPanel.column1 || inputPanel.column2);
 
        if (me.subject && !me.title) {
-           me.title = Proxmox.Utils.dialog_title(me.subject, me.create, me.isAdd);
+           me.title = Proxmox.Utils.dialog_title(me.subject, me.isCreate, me.isAdd);
        }
 
-       if (me.create) {
+       if (me.isCreate) {
                me.buttons = [ submitBtn ] ;
        } else {
                me.buttons = [ submitBtn, resetBtn ];