Skip to content

Commit

Permalink
Update modx.grid.role.js
Browse files Browse the repository at this point in the history
Fix merge issue from last rebase
  • Loading branch information
smg6511 committed Sep 6, 2024
1 parent 004fffa commit 08fd558
Showing 1 changed file with 22 additions and 29 deletions.
51 changes: 22 additions & 29 deletions manager/assets/modext/widgets/security/modx.grid.role.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,27 +42,24 @@ MODx.grid.Role = function(config = {}) {
blankText: _('role_err_ns_name'),
validationEvent: 'change',
validator: function(value) {
const grid = Ext.getCmp('modx-grid-role'),
reserved = this.gridEditor.record.json.reserved.name
const
grid = Ext.getCmp('modx-grid-role'),
reserved = this.gridEditor.record.json.reserved.name
;
if (grid.valueIsReserved(reserved, value)) {
const msg = _('role_err_name_reserved', { reservedName: value });
Ext.Msg.alert(_('error'), msg);
return false;
} else {
return true;
}
return true;
}
},
renderer: {
fn: function(value, metaData, record) {
// Integrate this
// metaData.css = this.setEditableCellClasses(record);
if (!this.userCanEdit || record.json.isProtected) {
metaData.css = 'editor-disabled';
}
value = record.json.isProtected ? record.json.name_trans : value ;
return Ext.util.Format.htmlEncode(value);
const renderValue = record.json.isProtected ? record.json.name_trans : value ;
// eslint-disable-next-line no-param-reassign
metaData.css = this.setEditableCellClasses(record, [record.json.isProtected]);
return Ext.util.Format.htmlEncode(renderValue);
},
scope: this
}
Expand All @@ -76,13 +73,10 @@ MODx.grid.Role = function(config = {}) {
},
renderer: {
fn: function(value, metaData, record) {
// Integrate this
// metaData.css = this.setEditableCellClasses(record);
if (!this.userCanEdit || record.json.isProtected) {
metaData.css = 'editor-disabled';
}
value = record.json.isProtected ? record.json.description_trans : value ;
return Ext.util.Format.htmlEncode(value);
const renderValue = record.json.isProtected ? record.json.description_trans : value ;
// eslint-disable-next-line no-param-reassign
metaData.css = this.setEditableCellClasses(record, [record.json.isProtected]);
return Ext.util.Format.htmlEncode(renderValue);
},
scope: this
}
Expand Down Expand Up @@ -110,11 +104,8 @@ MODx.grid.Role = function(config = {}) {
},
renderer: {
fn: function(value, metaData, record, rowIndex, colIndex, store) {
// Integrate this
// metaData.css = this.setEditableCellClasses(record, [record.json.isAssigned]);
if (!this.userCanEdit || record.json.isProtected) {
metaData.css = 'editor-disabled';
}
// eslint-disable-next-line no-param-reassign
metaData.css = this.setEditableCellClasses(record, [record.json.isAssigned, record.json.isProtected], '', false);
return value;
},
scope: this
Expand Down Expand Up @@ -188,17 +179,16 @@ MODx.grid.Role = function(config = {}) {
}
}
});

};
Ext.extend(MODx.grid.Role, MODx.grid.Grid, {

getMenu: function() {
const
record = this.getSelectionModel().getSelected(),
permissions = record.data.perm || '',
permissions = record.json.permissions || '',
menu = []
;
if (permissions.indexOf('remove') !== -1) {
if (permissions.delete) {
menu.push({
text: _('delete'),
handler: this.remove.createDelegate(this, ['role_remove_confirm', 'Security/Role/Remove'])
Expand Down Expand Up @@ -244,7 +234,8 @@ MODx.window.CreateRole = function(config = {}) {
fieldLabel: _('name'),
xtype: 'textfield'
}, {
xtype: MODx.expandHelp ? 'box' : 'hidden',
xtype: 'box',
hidden: !MODx.expandHelp,
html: _('role_desc_name'),
cls: 'desc-under'
}, {
Expand All @@ -255,7 +246,8 @@ MODx.window.CreateRole = function(config = {}) {
value: 0,
maxValue: 9999
}, {
xtype: MODx.expandHelp ? 'box' : 'hidden',
xtype: 'box',
hidden: !MODx.expandHelp,
html: _('role_desc_authority'),
cls: 'desc-under'
}, {
Expand All @@ -265,7 +257,8 @@ MODx.window.CreateRole = function(config = {}) {
allowBlank: true,
grow: true
}, {
xtype: MODx.expandHelp ? 'box' : 'hidden',
xtype: 'box',
hidden: !MODx.expandHelp,
html: _('role_desc_description'),
cls: 'desc-under'
}],
Expand Down

0 comments on commit 08fd558

Please sign in to comment.