Fixed label toggle text
This commit is contained in:
parent
7418873b41
commit
2d38d35b0d
1 changed files with 17 additions and 14 deletions
|
@ -212,21 +212,24 @@
|
||||||
},
|
},
|
||||||
selectable: true,
|
selectable: true,
|
||||||
filterable: true,
|
filterable: true,
|
||||||
|
selected: $dropdown.data('selected') || [],
|
||||||
toggleLabel: function(selected, el) {
|
toggleLabel: function(selected, el) {
|
||||||
var selected_labels;
|
var isSelected = el !== null ? el.hasClass('is-active') : false,
|
||||||
selected_labels = $('.js-label-select').siblings('.dropdown-menu-labels').find('.is-active');
|
title = selected.title;
|
||||||
if (selected && (selected.title != null)) {
|
|
||||||
if (selected_labels.length > 1) {
|
if (isSelected) {
|
||||||
return selected.title + " +" + (selected_labels.length - 1) + " more";
|
this.selected.push(title);
|
||||||
} else {
|
} else {
|
||||||
return selected.title;
|
var index = this.selected.indexOf(title);
|
||||||
}
|
this.selected.splice(index, 1);
|
||||||
} else if (!selected && selected_labels.length !== 0) {
|
}
|
||||||
if (selected_labels.length > 1) {
|
|
||||||
return ($(selected_labels[0]).text()) + " +" + (selected_labels.length - 1) + " more";
|
var selectedLabels = this.selected;
|
||||||
} else if (selected_labels.length === 1) {
|
|
||||||
return $(selected_labels).text();
|
if (selectedLabels.length === 1) {
|
||||||
}
|
return selectedLabels;
|
||||||
|
} else if (selectedLabels.length > 1) {
|
||||||
|
return selectedLabels[0] + " +" + (selectedLabels.length - 1) + " more";
|
||||||
} else {
|
} else {
|
||||||
return defaultLabel;
|
return defaultLabel;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue