Only use label_singular when one item is rendered in the listControl (#1422)

This commit is contained in:
Robert Karlsson 2018-06-12 15:47:20 +02:00 committed by Shawn Erquhart
parent b47bb66a3b
commit f365955478

View File

@ -262,14 +262,15 @@ export default class ListControl extends Component {
const { value, forID, field, classNameWrapper } = this.props;
const { itemsCollapsed } = this.state;
const items = value || List();
const label = field.get('label_singular') || field.get('label');
const label = field.get('label');
const labelSingular = field.get('label_singular') || field.get('label');
return (
<div id={forID} className={c(classNameWrapper, 'nc-listControl')}>
<TopBar
allowAdd={field.get('allow_add', true)}
onAdd={this.handleAdd}
listLabel={label.toLowerCase()}
listLabel={items.size === 1 ? labelSingular.toLowerCase() : label.toLowerCase()}
onCollapseAllToggle={this.handleCollapseAllToggle}
allItemsCollapsed={itemsCollapsed.every(val => val === true)}
itemsCount={items.size}