Commit a46d0bbb authored by Alfredo Sumaran's avatar Alfredo Sumaran

Pluralize dropdown label

parent b7ff3b3b
......@@ -51,12 +51,14 @@
let types = _.groupBy(currentItems, (item) => { return item.dataset.type; });
let label = [];
if (_.isEmpty(types)) {
label.push(this.defaultLabel);
} else {
if (currentItems.length) {
Object.keys(types).map((type) => {
label.push(`${types[type].length} ${type}`);
let numberOfTypes = types[type].length;
let text = numberOfTypes === 1 ? type : `${type}s`;
label.push(`${numberOfTypes} ${text}`);
});
} else {
label.push(this.defaultLabel);
}
return label.join(' and ');
......
Markdown is supported
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