Skip to content

Commit

Permalink
Fix sonarcloud issues
Browse files Browse the repository at this point in the history
  • Loading branch information
blankse committed Aug 7, 2024
1 parent ba319c4 commit de8e272
Showing 1 changed file with 13 additions and 14 deletions.
27 changes: 13 additions & 14 deletions public/js/pimcore/element/helpers/gridCellEditor.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,40 +36,39 @@ Ext.define('pimcore.element.helpers.gridCellEditor', {

value = Ext.clone(value);

var fieldInfo = Ext.clone(this.config.fieldInfo);
var fieldType = this.config.elementType;
const fieldInfo = Ext.clone(this.config.fieldInfo);
const fieldType = this.config.elementType;

//make sure that no relation data is loaded async
fieldInfo.layout.optimizedAdminLoading = false;

if(!fieldInfo || !fieldInfo.layout) {
if (!fieldInfo?.layout) {
return;
}

if(fieldInfo.layout.noteditable) {
if (fieldInfo.layout.noteditable) {
pimcore.helpers.showNotification(t('warning'), t('this_element_cannot_be_edited'), 'warning');
return;
}

this.context = this.editingPlugin.context;
// this.callParent(arguments);

var tagType = fieldInfo.layout.fieldtype;
const tagType = fieldInfo.layout.fieldtype;

// translate title
if(typeof fieldInfo.layout.title != "undefined") {
fieldInfo.layout.title = t(fieldInfo.layout.title);
}


let tag;
if (fieldType == "assetmetadata") {
var tag = new pimcore.asset.metadata.tags[tagType](value, fieldInfo.layout);
tag = new pimcore.asset.metadata.tags[tagType](value, fieldInfo.layout);
} else {
var tag = new pimcore[fieldType].tags[tagType](value, fieldInfo.layout);
tag = new pimcore[fieldType].tags[tagType](value, fieldInfo.layout);
}

if(fieldType == 'object') {
var object = Ext.clone(this.context.record);
const object = Ext.clone(this.context.record);
tag.setObject(object);
tag.updateContext({
objectId: object.id
Expand All @@ -85,7 +84,7 @@ Ext.define('pimcore.element.helpers.gridCellEditor', {
tag.finishSetup();
}

var formPanel = Ext.create('Ext.form.Panel', {
const formPanel = Ext.create('Ext.form.Panel', {
xtype: "form",
border: false,
items: [tag.getLayoutEdit()],
Expand Down Expand Up @@ -148,10 +147,10 @@ Ext.define('pimcore.element.helpers.gridCellEditor', {
},

completeEdit: function(remainVisible) {
var me = this,
const me = this,
fieldInfo = me.config.fieldInfo,
startValue = me.startValue,
value;
startValue = me.startValue;
let value;

if (fieldInfo.layout.noteditable) {
return;
Expand Down

0 comments on commit de8e272

Please sign in to comment.