Add label_singular to collection config (#1086)

This commit is contained in:
Pedro Duarte
2018-02-19 17:00:52 +00:00
committed by Jessica Parsons
parent 952a6d509f
commit 49894d9fd9
8 changed files with 25 additions and 8 deletions

View File

@ -73,7 +73,7 @@ export default class Header extends React.Component {
collections.filter(collection => collection.get('create')).toList().map(collection =>
<DropdownItem
key={collection.get("name")}
label={collection.get("label")}
label={collection.get("label_singular") || collection.get("label")}
onClick={() => this.handleCreatePostClick(collection.get('name'))}
/>
)

View File

@ -46,6 +46,7 @@ class Collection extends React.Component {
? null
: <CollectionTop
collectionLabel={collection.get('label')}
collectionLabelSingular={collection.get('label_singular')}
collectionDescription={collection.get('description')}
newEntryUrl={newEntryUrl}
viewStyle={this.state.viewStyle}

View File

@ -7,6 +7,7 @@ import { VIEW_STYLE_LIST, VIEW_STYLE_GRID } from 'Constants/collectionViews';
const CollectionTop = ({
collectionLabel,
collectionLabelSingular,
collectionDescription,
viewStyle,
onChangeViewStyle,
@ -19,7 +20,7 @@ const CollectionTop = ({
{
newEntryUrl
? <Link className="nc-collectionPage-topNewButton" to={newEntryUrl}>
{`New ${collectionLabel}`}
{`New ${collectionLabelSingular || collectionLabel}`}
</Link>
: null
}

View File

@ -254,12 +254,13 @@ 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');
return (
<div id={forID} className={c(classNameWrapper, 'nc-listControl')}>
<TopBar
onAdd={this.handleAdd}
listLabel={field.get('label').toLowerCase()}
listLabel={label.toLowerCase()}
onCollapseAllToggle={this.handleCollapseAllToggle}
allItemsCollapsed={itemsCollapsed.every(val => val === true)}
itemsCount={items.size}