fix settings array fields

This commit is contained in:
Yuri Kuznetsov
2014-12-03 12:03:17 +02:00
parent a965f6037f
commit 094f39e987
7 changed files with 134 additions and 27 deletions
@@ -113,16 +113,18 @@
},
"tabList": {
"type": "array",
"translation": "Global.scopeNamesPlural"
"translation": "Global.scopeNamesPlural",
"view": "Settings.Fields.TabList"
},
"quickCreateList": {
"type": "array",
"translation": "Global.scopeNames"
"translation": "Global.scopeNames",
"view": "Settings.Fields.QuickCreateList"
},
"language": {
"type": "enum",
"options": ["en_US"],
"default": "en_US"
"default": "en_US"
},
"exportDelimiter": {
"type": "varchar",
@@ -204,7 +206,8 @@
},
"assignmentEmailNotificationsEntityList": {
"type": "multiEnum",
"translation": "Global.scopeNamesPlural"
"translation": "Global.scopeNamesPlural",
"view": "Settings.Fields.AssignmentEmailNotificationsEntityList"
},
"b2cMode": {
"type": "bool",
@@ -8,6 +8,11 @@
{
"name":"options",
"type":"array"
},
{
"name":"translation",
"type":"varchar",
"hidden": true
}
],
"filter": false,
@@ -63,9 +63,6 @@ Espo.define('Views.Admin.OutboundEmail', 'Views.Settings.Record.Edit', function
setup: function () {
Dep.prototype.setup.call(this);
this.model.defs.fields.assignmentEmailNotificationsEntityList.options = Object.keys(this.getMetadata().get('scopes')).filter(function (scope) {
return this.getMetadata().get('scopes.' + scope + '.tab') && this.getMetadata().get('scopes.' + scope + '.entity');
}, this);
},
afterRender: function () {
@@ -17,31 +17,15 @@
*
* You should have received a copy of the GNU General Public License
* along with EspoCRM. If not, see http://www.gnu.org/licenses/.
************************************************************************/
************************************************************************/
Espo.define('Views.Admin.UserInterface', 'Views.Settings.Record.Edit', function (Dep) {
Espo.define('Views.Admin.UserInterface', 'Views.Settings.Record.Edit', function (Dep) {
return Dep.extend({
layoutName: 'userInterface',
setup: function () {
Dep.prototype.setup.call(this);
layoutName: 'userInterface',
this.model.defs.fields.tabList.options = Object.keys(this.getMetadata().get('scopes')).filter(function (scope) {
return this.getMetadata().get('scopes.' + scope + '.tab');
}, this).sort(function (v1, v2) {
return this.translate(v1, 'scopeNamesPlural').localeCompare(this.translate(v2, 'scopeNamesPlural'));
}.bind(this));
this.model.defs.fields.quickCreateList.options = Object.keys(this.getMetadata().get('scopes')).filter(function (scope) {
return this.getMetadata().get('scopes.' + scope + '.entity') && this.getMetadata().get('scopes.' + scope + '.tab');
}, this).sort(function (v1, v2) {
return this.translate(v1, 'scopeNamesPlural').localeCompare(this.translate(v2, 'scopeNamesPlural'));
}.bind(this));
},
});
});
});
@@ -0,0 +1,40 @@
/************************************************************************
* This file is part of EspoCRM.
*
* EspoCRM - Open Source CRM application.
* Copyright (C) 2014 Yuri Kuznetsov, Taras Machyshyn, Oleksiy Avramenko
* Website: http://www.espocrm.com
*
* EspoCRM is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* EspoCRM 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with EspoCRM. If not, see http://www.gnu.org/licenses/.
************************************************************************/
Espo.define('Views.Settings.Fields.AssignmentEmailNotificationsEntityList', 'Views.Fields.MultiEnum', function (Dep) {
return Dep.extend({
setup: function () {
this.params.options = Object.keys(this.getMetadata().get('scopes')).filter(function (scope) {
return this.getMetadata().get('scopes.' + scope + '.tab') && this.getMetadata().get('scopes.' + scope + '.entity');
}, this).sort(function (v1, v2) {
return this.translate(v1, 'scopeNamesPlural').localeCompare(this.translate(v2, 'scopeNamesPlural'));
}.bind(this));
Dep.prototype.setup.call(this);
console.log(this.translatedOptions);
},
});
});
@@ -0,0 +1,39 @@
/************************************************************************
* This file is part of EspoCRM.
*
* EspoCRM - Open Source CRM application.
* Copyright (C) 2014 Yuri Kuznetsov, Taras Machyshyn, Oleksiy Avramenko
* Website: http://www.espocrm.com
*
* EspoCRM is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* EspoCRM 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with EspoCRM. If not, see http://www.gnu.org/licenses/.
************************************************************************/
Espo.define('Views.Settings.Fields.QuickCreateList', 'Views.Fields.Array', function (Dep) {
return Dep.extend({
setup: function () {
this.params.options = Object.keys(this.getMetadata().get('scopes')).filter(function (scope) {
return this.getMetadata().get('scopes.' + scope + '.entity') && this.getMetadata().get('scopes.' + scope + '.tab');
}, this).sort(function (v1, v2) {
return this.translate(v1, 'scopeNamesPlural').localeCompare(this.translate(v2, 'scopeNamesPlural'));
}.bind(this));
Dep.prototype.setup.call(this);
},
});
});
@@ -0,0 +1,39 @@
/************************************************************************
* This file is part of EspoCRM.
*
* EspoCRM - Open Source CRM application.
* Copyright (C) 2014 Yuri Kuznetsov, Taras Machyshyn, Oleksiy Avramenko
* Website: http://www.espocrm.com
*
* EspoCRM is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* EspoCRM 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with EspoCRM. If not, see http://www.gnu.org/licenses/.
************************************************************************/
Espo.define('Views.Settings.Fields.TabList', 'Views.Fields.Array', function (Dep) {
return Dep.extend({
setup: function () {
this.params.options = Object.keys(this.getMetadata().get('scopes')).filter(function (scope) {
return this.getMetadata().get('scopes.' + scope + '.tab');
}, this).sort(function (v1, v2) {
return this.translate(v1, 'scopeNamesPlural').localeCompare(this.translate(v2, 'scopeNamesPlural'));
}.bind(this));
Dep.prototype.setup.call(this);
},
});
});