Verified Commit 026916c2 authored by Andrey Vertiprahov's avatar Andrey Vertiprahov
Browse files

Fix if.

parent b917142c
......@@ -124,8 +124,7 @@ Ext.define("NOC.core.label.LabelField", {
},
filterPicked: function(rec) {
var me = this;
return !this.valueCollection.contains(rec) && !(rec.get("is_protected") && me.filterProtected);
return !this.valueCollection.contains(rec) && !(rec.get("is_protected") && this.filterProtected);
},
onKeyDown: function(e) {
......@@ -151,10 +150,10 @@ Ext.define("NOC.core.label.LabelField", {
lastSelectionIndex = -1;
}
valueCollection.remove(Ext.Array.filter(selModel.getSelection(), function(el) {
return !el.get("is_protected")
return !el.get("is_protected") && me.filterProtected
}));
} else {
if(!valueCollection.last().get("is_protected")) {
if(!valueCollection.last().get("is_protected") && me.filterProtected) {
valueCollection.remove(valueCollection.last());
}
}
......@@ -233,14 +232,14 @@ Ext.define("NOC.core.label.LabelField", {
'%}',
me.tipTpl ? '" data-qtip="{[this.getTip(values)]}">' : '">',
'<div class="' + me.tagItemTextCls + '">{[this.getItemLabel(values)]}</div>',
'<tpl if="!is_protected">',
'<tpl if="!is_protected || !this.filterProtected">',
'<div class="' + me.tagItemCloseCls + childElCls + '"></div>',
'</tpl>',
'</li>',
'</tpl>',
{
isProtected: function(rec) {
return rec.get("is_protected");
return rec.get("is_protected") && me.filterProtected;
},
isSelected: function(rec) {
return me.selectionModel.isSelected(rec);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment