dynamicLogic string change

This commit is contained in:
yuri
2016-09-02 12:31:45 +03:00
parent 6bedd86e08
commit b7e14d60cc
10 changed files with 77 additions and 121 deletions
@@ -30,6 +30,10 @@
"type": "notEquals",
"attribute": "status",
"value": "Canceled"
},
{
"type": "isNotEmpty",
"attribute": "status"
}
]
}
@@ -0,0 +1,48 @@
{
"itemTypes": {
"and": {
"view": "views/admin/dynamic-logic/conditions-string/group-base",
"operator": "and"
},
"or": {
"view": "views/admin/dynamic-logic/conditions-string/group-base",
"operator": "or"
},
"not": {
"view": "views/admin/dynamic-logic/conditions-string/group-not",
"operator": "not"
},
"equals": {
"view": "views/admin/dynamic-logic/conditions-string/item-base",
"operatorString": "="
},
"notEquals": {
"view": "views/admin/dynamic-logic/conditions-string/item-base",
"operatorString": "≠"
},
"greaterThan": {
"view": "views/admin/dynamic-logic/conditions-string/item-base",
"operatorString": ">"
},
"lessThan": {
"view": "views/admin/dynamic-logic/conditions-string/item-base",
"operatorString": "<"
},
"greaterThanOrEquals": {
"view": "views/admin/dynamic-logic/conditions-string/item-base",
"operatorString": "≥"
},
"lessThanOrEquals": {
"view": "views/admin/dynamic-logic/conditions-string/item-base",
"operatorString": "≤"
},
"isEmpty": {
"view": "views/admin/dynamic-logic/conditions-string/item-operator-only-base",
"operatorString": "= ∅"
},
"isNotEmpty": {
"view": "views/admin/dynamic-logic/conditions-string/item-operator-only-base",
"operatorString": "≠ ∅"
}
}
}
@@ -0,0 +1 @@
{{translate field category='fields' scope=scope}} {{{operatorString}}}
@@ -1,38 +0,0 @@
/************************************************************************
* This file is part of EspoCRM.
*
* EspoCRM - Open Source CRM application.
* Copyright (C) 2014-2015 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/.
*
* 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 General Public License version 3.
*
* In accordance with Section 7(b) of the GNU General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "EspoCRM" word.
************************************************************************/
Espo.define('views/admin/dynamic-logic/conditions-string/equals', 'views/admin/dynamic-logic/conditions-string/item-base', function (Dep) {
return Dep.extend({
operatorString: '='
});
});
@@ -50,6 +50,8 @@ Espo.define('views/admin/dynamic-logic/conditions-string/group-base', 'view', fu
this.number = this.options.number || 0;
this.scope = this.options.scope;
this.operator = this.options.operator || this.operator;
this.itemData = this.options.itemData || {};
this.viewList = [];
@@ -71,12 +73,21 @@ Espo.define('views/admin/dynamic-logic/conditions-string/group-base', 'view', fu
this.viewList.push(key);
var type = item.type || 'equals';
this.createView(key, 'views/admin/dynamic-logic/conditions-string/' + Espo.Utils.camelCaseToHyphen(type), {
var viewName = this.getMetadata().get(['clientDefs', 'DynamicLogic', 'itemTypes', type, 'view']);
if (!viewName) return;
var operator = this.getMetadata().get(['clientDefs', 'DynamicLogic', 'itemTypes', type, 'operator']);
var operatorString = this.getMetadata().get(['clientDefs', 'DynamicLogic', 'itemTypes', type, 'operatorString']);
this.createView(key, viewName, {
itemData: item,
scope: this.scope,
level: this.level + 1,
el: '[data-view-key="'+key+'"]',
number: number
number: number,
operator: operator,
operatorString: operatorString
});
},
@@ -49,6 +49,9 @@ Espo.define('views/admin/dynamic-logic/conditions-string/item-base', 'view', fun
this.number = this.options.number || 0;
this.scope = this.options.scope;
this.operator = this.options.operator || this.operator;
this.operatorString = this.options.operatorString || this.operatorString;
this.field = (this.itemData.data || {}).field || this.itemData.attribute;
this.additionalData = (this.itemData.data || {});
@@ -26,11 +26,14 @@
* these Appropriate Legal Notices must retain the display of the "EspoCRM" word.
************************************************************************/
Espo.define('views/admin/dynamic-logic/conditions-string/and', 'views/admin/dynamic-logic/conditions-string/group-base', function (Dep) {
Espo.define('views/admin/dynamic-logic/conditions-string/item-operator-only-base', 'views/admin/dynamic-logic/conditions-string/item-base', function (Dep) {
return Dep.extend({
operator: 'and'
template: 'admin/dynamic-logic/conditions-string/item-operator-only-base',
createValueFieldView: function () {
},
});
@@ -1,38 +0,0 @@
/************************************************************************
* This file is part of EspoCRM.
*
* EspoCRM - Open Source CRM application.
* Copyright (C) 2014-2015 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/.
*
* 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 General Public License version 3.
*
* In accordance with Section 7(b) of the GNU General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "EspoCRM" word.
************************************************************************/
Espo.define('views/admin/dynamic-logic/conditions-string/not-equals', 'views/admin/dynamic-logic/conditions-string/item-base', function (Dep) {
return Dep.extend({
operatorString: '≠'
});
});
@@ -1,38 +0,0 @@
/************************************************************************
* This file is part of EspoCRM.
*
* EspoCRM - Open Source CRM application.
* Copyright (C) 2014-2015 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/.
*
* 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 General Public License version 3.
*
* In accordance with Section 7(b) of the GNU General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "EspoCRM" word.
************************************************************************/
Espo.define('views/admin/dynamic-logic/conditions-string/or', 'views/admin/dynamic-logic/conditions-string/group-base', function (Dep) {
return Dep.extend({
operator: 'or'
});
});
@@ -38,11 +38,11 @@ Espo.define('views/admin/field-manager/fields/dynamic-logic-conditions', 'views/
setup: function () {
var conditionGroup = (this.model.get(this.name) || {}).conditionGroup || [];
this.createView('conditionGroup', 'views/admin/dynamic-logic/conditions-string/and', {
this.createView('conditionGroup', 'views/admin/dynamic-logic/conditions-string/group-base', {
itemData: {
type: 'and',
value: conditionGroup
},
operator: 'and',
scope: this.options.scope
});
},
@@ -95,7 +95,7 @@ Espo.define('views/admin/field-manager/fields/dynamic-logic-conditions', 'views/
case 'greaterThanOrEquals':
operator = '≥';
break;
case 'greaterThanOrEquals':
case 'lessThanOrEquals':
operator = '≤';
break;
case 'isEmpty':