From ecaf8ab87cd34746cbe9a368d968969bd6e8aa40 Mon Sep 17 00:00:00 2001 From: Andy Weichler <53085804+aweichler@users.noreply.github.com> Date: Thu, 3 Aug 2023 16:13:02 +0200 Subject: [PATCH] Fix attribute tooltip for numeric (#105) * Fix line break for file "Numeric.js" * Fix attribute is shown in tooltip for numeric fields --- .../outputDataConfigElements/value/Numeric.js | 254 +++++++++--------- 1 file changed, 128 insertions(+), 126 deletions(-) diff --git a/src/Resources/public/js/outputDataConfigElements/value/Numeric.js b/src/Resources/public/js/outputDataConfigElements/value/Numeric.js index cd1e08a..1fafa81 100644 --- a/src/Resources/public/js/outputDataConfigElements/value/Numeric.js +++ b/src/Resources/public/js/outputDataConfigElements/value/Numeric.js @@ -12,130 +12,132 @@ */ -pimcore.registerNS("pimcore.bundle.outputDataConfigToolkit.outputDataConfigElements.value.Numeric"); - -pimcore.bundle.outputDataConfigToolkit.outputDataConfigElements.value.Numeric = Class.create(pimcore.bundle.outputDataConfigToolkit.outputDataConfigElements.Abstract, { - - type: "value", - class: "Numeric", - - getConfigTreeNode: function(configAttributes) { - var node = { - draggable: true, - iconCls: "pimcore_icon_" + configAttributes.dataType, - text: configAttributes.text, - configAttributes: configAttributes, - isTarget: true, - leaf: true - }; - - return node; - }, - - getCopyNode: function(source) { - var copy = source.createNode({ - iconCls: source.data.iconCls, - text: source.data.text, - isTarget: true, - leaf: true, - dataType: source.data.dataType, - configAttributes: { - label: null, - type: this.type, - class: this.class, - attribute: source.data.key, - dataType: source.data.dataType - } - }); - return copy; - }, - - getConfigDialog: function(node) { - this.node = node; - - var value = "original"; - if(this.node.data.configAttributes.label) { - value = "custom"; - } - - this.textfield = new Ext.form.TextField({ - fieldLabel: t('custom_title'), - disabled: true, - length: 255, - width: 200, - value: this.node.data.text - }); - - this.radiogroup = new Ext.form.RadioGroup({ - fieldLabel: t('config_title'), - vertical: false, - columns: 1, - value: {rb: value}, - items: [ - {boxLabel: t('config_title_original'), name: 'rb', inputValue: "original", checked: true}, - { - boxLabel: t('config_title_custom'), - name: 'rb', - inputValue: "custom", - listeners: { - change: function(element, newValue) { - this.textfield.setDisabled(!newValue); - }.bind(this) - } - } - ] - }); - - this.formatNumber = new Ext.form.Checkbox({ - fieldLabel: t('format_number'), - length: 255, - width: 200, - checked: this.node.data.configAttributes.formatNumber - }); - - - this.precision = new Ext.form.NumberField({ - fieldLabel: t('precision'), - length: 255, - width: 200, - value: this.node.data.configAttributes.precision - }); - - this.configPanel = new Ext.Panel({ - layout: "form", - bodyStyle: "padding: 10px;", - items: [this.radiogroup, this.textfield, this.formatNumber, this.precision], - buttons: [{ - text: t("apply"), - iconCls: "pimcore_icon_apply", - handler: function () { - this.commitData(); - }.bind(this) - }] - }); - - this.window = new Ext.Window({ - width: 400, - height: 320, - modal: true, - title: t('attribute_settings'), - layout: "fit", - items: [this.configPanel] - }); - - this.window.show(); - return this.window; - }, - - commitData: function() { - this.node.data.configAttributes.precision = this.precision.getValue(); - this.node.data.configAttributes.formatNumber = this.formatNumber.getValue(); - if(this.radiogroup.getValue().rb == "custom") { - this.node.data.configAttributes.label = this.textfield.getValue(); - this.node.set('text', this.textfield.getValue()); - } else { - this.node.data.configAttributes.label = null; - } - this.window.close(); - } +pimcore.registerNS("pimcore.bundle.outputDataConfigToolkit.outputDataConfigElements.value.Numeric"); + +pimcore.bundle.outputDataConfigToolkit.outputDataConfigElements.value.Numeric = Class.create(pimcore.bundle.outputDataConfigToolkit.outputDataConfigElements.Abstract, { + + type: "value", + class: "Numeric", + + getConfigTreeNode: function(configAttributes) { + var node = { + draggable: true, + iconCls: "pimcore_icon_" + configAttributes.dataType, + text: configAttributes.text, + qtip: configAttributes.attribute, + configAttributes: configAttributes, + isTarget: true, + leaf: true + }; + + return node; + }, + + getCopyNode: function(source) { + var copy = source.createNode({ + iconCls: source.data.iconCls, + text: source.data.text, + isTarget: true, + leaf: true, + dataType: source.data.dataType, + qtip: source.data.key, + configAttributes: { + label: null, + type: this.type, + class: this.class, + attribute: source.data.key, + dataType: source.data.dataType + } + }); + return copy; + }, + + getConfigDialog: function(node) { + this.node = node; + + var value = "original"; + if(this.node.data.configAttributes.label) { + value = "custom"; + } + + this.textfield = new Ext.form.TextField({ + fieldLabel: t('custom_title'), + disabled: true, + length: 255, + width: 200, + value: this.node.data.text + }); + + this.radiogroup = new Ext.form.RadioGroup({ + fieldLabel: t('config_title'), + vertical: false, + columns: 1, + value: {rb: value}, + items: [ + {boxLabel: t('config_title_original'), name: 'rb', inputValue: "original", checked: true}, + { + boxLabel: t('config_title_custom'), + name: 'rb', + inputValue: "custom", + listeners: { + change: function(element, newValue) { + this.textfield.setDisabled(!newValue); + }.bind(this) + } + } + ] + }); + + this.formatNumber = new Ext.form.Checkbox({ + fieldLabel: t('format_number'), + length: 255, + width: 200, + checked: this.node.data.configAttributes.formatNumber + }); + + + this.precision = new Ext.form.NumberField({ + fieldLabel: t('precision'), + length: 255, + width: 200, + value: this.node.data.configAttributes.precision + }); + + this.configPanel = new Ext.Panel({ + layout: "form", + bodyStyle: "padding: 10px;", + items: [this.radiogroup, this.textfield, this.formatNumber, this.precision], + buttons: [{ + text: t("apply"), + iconCls: "pimcore_icon_apply", + handler: function () { + this.commitData(); + }.bind(this) + }] + }); + + this.window = new Ext.Window({ + width: 400, + height: 320, + modal: true, + title: t('attribute_settings'), + layout: "fit", + items: [this.configPanel] + }); + + this.window.show(); + return this.window; + }, + + commitData: function() { + this.node.data.configAttributes.precision = this.precision.getValue(); + this.node.data.configAttributes.formatNumber = this.formatNumber.getValue(); + if(this.radiogroup.getValue().rb == "custom") { + this.node.data.configAttributes.label = this.textfield.getValue(); + this.node.set('text', this.textfield.getValue()); + } else { + this.node.data.configAttributes.label = null; + } + this.window.close(); + } }); \ No newline at end of file