Only use label_singular when one item is rendered in the listControl (#1422)
This commit is contained in:
parent
b47bb66a3b
commit
f365955478
@ -262,14 +262,15 @@ export default class ListControl extends Component {
|
|||||||
const { value, forID, field, classNameWrapper } = this.props;
|
const { value, forID, field, classNameWrapper } = this.props;
|
||||||
const { itemsCollapsed } = this.state;
|
const { itemsCollapsed } = this.state;
|
||||||
const items = value || List();
|
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 (
|
return (
|
||||||
<div id={forID} className={c(classNameWrapper, 'nc-listControl')}>
|
<div id={forID} className={c(classNameWrapper, 'nc-listControl')}>
|
||||||
<TopBar
|
<TopBar
|
||||||
allowAdd={field.get('allow_add', true)}
|
allowAdd={field.get('allow_add', true)}
|
||||||
onAdd={this.handleAdd}
|
onAdd={this.handleAdd}
|
||||||
listLabel={label.toLowerCase()}
|
listLabel={items.size === 1 ? labelSingular.toLowerCase() : label.toLowerCase()}
|
||||||
onCollapseAllToggle={this.handleCollapseAllToggle}
|
onCollapseAllToggle={this.handleCollapseAllToggle}
|
||||||
allItemsCollapsed={itemsCollapsed.every(val => val === true)}
|
allItemsCollapsed={itemsCollapsed.every(val => val === true)}
|
||||||
itemsCount={items.size}
|
itemsCount={items.size}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user