Bug #210 Añadir automaticamente en el campo relevancy
This commit is contained in:
parent
a746d2d58f
commit
56f774a07f
|
@ -37,7 +37,7 @@ class ItemTags {
|
|||
|
||||
addItemTag() {
|
||||
if (this.instancedItemTags) {
|
||||
this.instancedItemTags.push({value: null, itemFk: this.params.id, tagFk: null, priority: null, showAddIcon: true});
|
||||
this.instancedItemTags.push({value: null, itemFk: this.params.id, tagFk: null, priority: this.getMaxPriority(this.instancedItemTags) + 1, showAddIcon: true});
|
||||
this._setIconAdd();
|
||||
}
|
||||
}
|
||||
|
@ -54,6 +54,15 @@ class ItemTags {
|
|||
}
|
||||
}
|
||||
|
||||
getMaxPriority(instancedItemTags) {
|
||||
let max = 0;
|
||||
instancedItemTags.forEach(tag => {
|
||||
if (tag.priority > max)
|
||||
max = tag.priority;
|
||||
});
|
||||
return max;
|
||||
}
|
||||
|
||||
_equalItemTags(oldTag, newTag) {
|
||||
return oldTag.tagFk === newTag.tagFk && oldTag.value === newTag.value && oldTag.priority === newTag.priority;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue