mirror of
https://github.com/espocrm/espocrm.git
synced 2026-06-28 15:06:06 +00:00
enum: show none
This commit is contained in:
@@ -1 +1,5 @@
|
||||
<span class="text-{{style}}">{{translateOption value scope=scope field=name}}</span>
|
||||
{{#if isNotEmpty}}
|
||||
<span class="text-{{style}}">{{translateOption value scope=scope field=name}}</span>
|
||||
{{else}}
|
||||
{{translate 'None'}}
|
||||
{{/if}}
|
||||
3
client/res/templates/fields/enum-styled/list.tpl
Normal file
3
client/res/templates/fields/enum-styled/list.tpl
Normal file
@@ -0,0 +1,3 @@
|
||||
{{#if isNotEmpty}}
|
||||
<span class="text-{{style}}">{{translateOption value scope=scope field=name}}</span>
|
||||
{{/if}}
|
||||
@@ -1 +1,5 @@
|
||||
{{translateOption value scope=scope field=name translatedOptions=translatedOptions}}
|
||||
{{#if isNotEmpty}}
|
||||
{{translateOption value scope=scope field=name translatedOptions=translatedOptions}}
|
||||
{{else}}
|
||||
{{translate 'None'}}
|
||||
{{/if}}
|
||||
3
client/res/templates/fields/enum/list.tpl
Normal file
3
client/res/templates/fields/enum/list.tpl
Normal file
@@ -0,0 +1,3 @@
|
||||
{{#if isNotEmpty}}
|
||||
{{translateOption value scope=scope field=name translatedOptions=translatedOptions}}
|
||||
{{/if}}
|
||||
@@ -26,13 +26,13 @@
|
||||
* these Appropriate Legal Notices must retain the display of the "EspoCRM" word.
|
||||
************************************************************************/
|
||||
|
||||
Espo.define('Views.Fields.EnumStyled', 'Views.Fields.Enum', function (Dep) {
|
||||
Espo.define('views/fields/enum-styled', 'views/fields/enum', function (Dep) {
|
||||
|
||||
return Dep.extend({
|
||||
|
||||
listTemplate: 'fields.enum-styled.detail',
|
||||
listTemplate: 'fields/enum-styled/list',
|
||||
|
||||
detailTemplate: 'fields.enum-styled.detail',
|
||||
detailTemplate: 'fields/enum-styled/detail',
|
||||
|
||||
data: function () {
|
||||
var value = this.model.get(this.name);
|
||||
@@ -49,7 +49,7 @@ Espo.define('Views.Fields.EnumStyled', 'Views.Fields.Enum', function (Dep) {
|
||||
Dep.prototype.setup.call(this);
|
||||
|
||||
this.styleHash = this.model.getFieldParam(this.name, 'style') || {};
|
||||
},
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
@@ -32,7 +32,7 @@ Espo.define('views/fields/enum', ['views/fields/base', 'lib!Selectize'], functio
|
||||
|
||||
type: 'enum',
|
||||
|
||||
listTemplate: 'fields/enum/detail',
|
||||
listTemplate: 'fields/enum/list',
|
||||
|
||||
detailTemplate: 'fields/enum/detail',
|
||||
|
||||
@@ -45,6 +45,16 @@ Espo.define('views/fields/enum', ['views/fields/base', 'lib!Selectize'], functio
|
||||
data: function () {
|
||||
var data = Dep.prototype.data.call(this);
|
||||
data.translatedOptions = this.translatedOptions;
|
||||
var value = this.model.get(this.name);
|
||||
if (
|
||||
value !== null
|
||||
&&
|
||||
value !== ''
|
||||
||
|
||||
value === '' && (value in (this.translatedOptions || {}))
|
||||
) {
|
||||
data.isNotEmpty = true;
|
||||
}
|
||||
return data;
|
||||
},
|
||||
|
||||
|
||||
@@ -45,6 +45,18 @@ Espo.define('views/fields/varchar', 'views/fields/base', function (Dep) {
|
||||
}, this.events || {});
|
||||
},
|
||||
|
||||
data: function () {
|
||||
var data = Dep.prototype.data.call(this);
|
||||
if (
|
||||
this.model.get(this.name) !== null
|
||||
&&
|
||||
this.model.get(this.name) !== ''
|
||||
) {
|
||||
data.isNotEmpty = true;
|
||||
}
|
||||
return data;
|
||||
},
|
||||
|
||||
handleSearchType: function (type) {
|
||||
if (~['isEmpty', 'isNotEmpty'].indexOf(type)) {
|
||||
this.$el.find('input.main-element').addClass('hidden');
|
||||
|
||||
Reference in New Issue
Block a user