Commit 3dfb19f4 authored by Petter Goksøyr Åsen's avatar Petter Goksøyr Åsen
Browse files

patron-client: special label for ageLimit zero DEICH-820

parent 0dfe84e1
......@@ -7,7 +7,7 @@ const WorkAgeLimit = ({ publications, intl }) => {
if (ageLimits.length === 1) {
return (
<MetaItem label={messages.ageLimit} data-automation-id="work_ageLimit">
{ageLimits[0]}
{ageLimits[0] === '0' ? <FormattedMessage {...messages.noAgeLimit} /> : ageLimits[0]}
</MetaItem>
)
} else if (ageLimits.length > 1) {
......@@ -36,6 +36,11 @@ export const messages = defineMessages({
description: 'Label for age limit meta',
defaultMessage: 'Age limit'
},
noAgeLimit: {
id: 'AgeLimit.noAgeLimit',
description: 'Label for no age limit',
defaultMessage: 'For all ages'
},
seePublication: {
id: 'WorkAgeLimit.seePublication',
description: 'Label telling you to look for age limits under publication information',
......
import React, { PropTypes } from 'react'
import { defineMessages } from 'react-intl'
import { defineMessages, FormattedMessage } from 'react-intl'
import MetaItem from '../../../MetaItem'
const AgeLimit = ({ ageLimit }) => {
if (ageLimit) {
return (
<MetaItem label={messages.ageLimit} data-automation-id="publication_ageLimit">{ageLimit}</MetaItem>
<MetaItem label={messages.ageLimit} data-automation-id="publication_ageLimit">{ageLimit === '0' ? <FormattedMessage {...messages.noAgeLimit} /> : ageLimit}</MetaItem>
)
} else {
return null
......@@ -21,6 +21,11 @@ export const messages = defineMessages({
id: 'AgeLimit.ageLimit',
description: 'Label for age limit meta',
defaultMessage: 'Age limit'
},
noAgeLimit: {
id: 'AgeLimit.noAgeLimit',
description: 'Label for no age limit',
defaultMessage: 'For all ages'
}
})
......
......@@ -2,6 +2,7 @@ export default {
'AdditionalInformation.additionalInfoToggleLess': 'Mindre om dette verket',
'AdditionalInformation.additionalInfoToggleMore': 'Mer om dette verket',
'AgeLimit.ageLimit': 'Aldersgrense',
'AgeLimit.noAgeLimit': 'Tillatt for alle',
'Author.labelBy': 'Av',
'AvailableFilter.availabilityLabel': 'Vis kun ledige',
'BiblioNumber.biblioNumber': 'Tittelnummer',
......
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