role permissions style

This commit is contained in:
Yuri Kuznetsov
2024-01-27 12:26:20 +02:00
parent 119948938e
commit 80a7765fdd
5 changed files with 89 additions and 13 deletions
@@ -17,14 +17,16 @@
"options": ["not-set", "yes", "no"],
"default": "not-set",
"tooltip": "Role.exportPermission",
"translation": "Role.options.levelList"
"translation": "Role.options.levelList",
"view": "views/role/fields/permission"
},
"massUpdatePermission": {
"type": "enum",
"options": ["not-set", "yes", "no"],
"default": "not-set",
"tooltip": "Role.massUpdatePermission",
"translation": "Role.options.levelList"
"translation": "Role.options.levelList",
"view": "views/role/fields/permission"
},
"createdAt": {
"type": "datetime",
@@ -11,63 +11,72 @@
"options": ["not-set", "all", "team", "no"],
"default": "not-set",
"tooltip": true,
"translation": "Role.options.levelList"
"translation": "Role.options.levelList",
"view": "views/role/fields/permission"
},
"userPermission": {
"type": "enum",
"options": ["not-set", "all", "team", "no"],
"default": "not-set",
"tooltip": true,
"translation": "Role.options.levelList"
"translation": "Role.options.levelList",
"view": "views/role/fields/permission"
},
"messagePermission": {
"type": "enum",
"options": ["not-set", "all", "team", "no"],
"default": "not-set",
"tooltip": true,
"translation": "Role.options.levelList"
"translation": "Role.options.levelList",
"view": "views/role/fields/permission"
},
"portalPermission": {
"type": "enum",
"options": ["not-set", "yes", "no"],
"default": "not-set",
"tooltip": true,
"translation": "Role.options.levelList"
"translation": "Role.options.levelList",
"view": "views/role/fields/permission"
},
"groupEmailAccountPermission": {
"type": "enum",
"options": ["not-set", "all", "team", "no"],
"default": "not-set",
"tooltip": true,
"translation": "Role.options.levelList"
"translation": "Role.options.levelList",
"view": "views/role/fields/permission"
},
"exportPermission": {
"type": "enum",
"options": ["not-set", "yes", "no"],
"default": "not-set",
"tooltip": true,
"translation": "Role.options.levelList"
"translation": "Role.options.levelList",
"view": "views/role/fields/permission"
},
"massUpdatePermission": {
"type": "enum",
"options": ["not-set", "yes", "no"],
"default": "not-set",
"tooltip": true,
"translation": "Role.options.levelList"
"translation": "Role.options.levelList",
"view": "views/role/fields/permission"
},
"dataPrivacyPermission": {
"type": "enum",
"options": ["not-set", "yes", "no"],
"default": "not-set",
"tooltip": true,
"translation": "Role.options.levelList"
"translation": "Role.options.levelList",
"view": "views/role/fields/permission"
},
"followerManagementPermission": {
"type": "enum",
"options": ["not-set", "all", "team", "no"],
"default": "not-set",
"tooltip": true,
"translation": "Role.options.levelList"
"translation": "Role.options.levelList",
"view": "views/role/fields/permission"
},
"data": {
"type": "jsonObject"
+3 -1
View File
@@ -5,7 +5,9 @@
<div class="cell col-sm-3 form-group" data-name="{{name}}">
<label class="control-label" data-name="{{name}}">{{translate name category="fields" scope="Role"}}</label>
<div class="field" data-name="{{name}}">
{{translateOption value scope="Role" field="assignmentPermission" translatedOptions=levelListTranslation}}
<span class="text-{{lookup ../styleMap value}}">
{{translateOption value scope="Role" field="assignmentPermission" translatedOptions=levelListTranslation}}
</span>
</div>
</div>
{{/each}}
@@ -0,0 +1,49 @@
/************************************************************************
* This file is part of EspoCRM.
*
* EspoCRM Open Source CRM application.
* Copyright (C) 2014-2024 Yurii Kuznietsov, Taras Machyshyn, Oleksii Avramenko
* Website: https://www.espocrm.com
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU Affero General Public License version 3.
*
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "EspoCRM" word.
************************************************************************/
import EnumFieldView from 'views/fields/enum';
export default class extends EnumFieldView {
setup() {
this.params.style = {
yes: 'success',
all: 'success',
account: 'info',
contact: 'info',
team: 'info',
own: 'warning',
no: 'danger',
enabled: 'success',
disabled: 'danger',
'not-set': 'default',
}
super.setup();
}
}
+15 -1
View File
@@ -35,10 +35,24 @@ define('views/user/modals/access', ['views/modal'], function (Dep) {
template: 'user/modals/access',
backdrop: true,
styleMap: {
yes: 'success',
all: 'success',
account: 'info',
contact: 'info',
team: 'info',
own: 'warning',
no: 'danger',
enabled: 'success',
disabled: 'danger',
'not-set': 'default',
},
data: function () {
return {
valuePermissionDataList: this.getValuePermissionList(),
levelListTranslation: this.getLanguage().get('Role', 'options', 'levelList') || {}
levelListTranslation: this.getLanguage().get('Role', 'options', 'levelList') || {},
styleMap: this.styleMap,
};
},