Skip to content

Commit

Permalink
[Bug] Fix tooltip (#53)
Browse files Browse the repository at this point in the history
* Fix tooltip with wrapperclass, replace deprecated method ts with t

* Check line
  • Loading branch information
mattamon authored May 15, 2023
1 parent 2223e90 commit 089df59
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 47 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,9 @@ pimcore.object.tags.dynamicPermissionResource = Class.create(pimcore.object.tags
name: name, //this.fieldConfig.name + '[' + name + ']',
triggerAction: "all",
editable: false,
fieldLabel: ts(config['label']),
fieldLabel: t(config['label']),
store: store,
itemCls: "object_field",
componentCls: this.getWrapperClassNames(),
width: (this.fieldConfig.labelWidth || 0) + 200
};

Expand Down
91 changes: 46 additions & 45 deletions src/Resources/public/js/datatypes/tags/permissionResource.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,49 +12,50 @@
*/


pimcore.registerNS("pimcore.object.tags.permissionResource");
pimcore.object.tags.permissionResource = Class.create(pimcore.object.tags.select, {

type: "permissionResource",

initialize: function (data, fieldConfig) {
this.data = data;
this.fieldConfig = fieldConfig;
},

getLayoutEdit: function () {

// generate store
var store = [];
var validValues = [];

for (var i = 0; i < this.fieldConfig.options.length; i++) {
store.push([this.fieldConfig.options[i].value, ts(this.fieldConfig.options[i].key)]);
validValues.push(this.fieldConfig.options[i].value);
}

var options = {
name: this.fieldConfig.name,
triggerAction: "all",
editable: false,
fieldLabel: this.fieldConfig.title,
store: store,
itemCls: "object_field",
width: this.fieldConfig.labelWidth + 200
};

if (typeof this.data == "string" || typeof this.data == "number") {
if (in_array(this.data, validValues)) {
options.value = this.data;
} else {
options.value = "";
}
} else {
options.value = "";
}

this.component = new Ext.form.ComboBox(options);

return this.component;
}
pimcore.registerNS("pimcore.object.tags.permissionResource");
pimcore.object.tags.permissionResource = Class.create(pimcore.object.tags.select, {

type: "permissionResource",

initialize: function (data, fieldConfig) {
this.data = data;
this.fieldConfig = fieldConfig;
},

getLayoutEdit: function () {

// generate store
var store = [];
var validValues = [];

for (var i = 0; i < this.fieldConfig.options.length; i++) {
store.push([this.fieldConfig.options[i].value, ts(this.fieldConfig.options[i].key)]);
validValues.push(this.fieldConfig.options[i].value);
}

var options = {
name: this.fieldConfig.name,
triggerAction: "all",
editable: false,
fieldLabel: this.fieldConfig.title,
store: store,
componentCls: this.getWrapperClassNames(),
itemCls: "object_field",
width: this.fieldConfig.labelWidth + 200
};

if (typeof this.data == "string" || typeof this.data == "number") {
if (in_array(this.data, validValues)) {
options.value = this.data;
} else {
options.value = "";
}
} else {
options.value = "";
}

this.component = new Ext.form.ComboBox(options);

return this.component;
}
});

0 comments on commit 089df59

Please sign in to comment.