Commit c7cc6a60 authored by Mattias Lundmark's avatar Mattias Lundmark
Browse files

Timber: DEICH-1371 Series search linting

parent c9fe93a7
......@@ -16,17 +16,17 @@ import SearchResultAddToFavourites from "./SearchResultAddToFavourites"
import ClickableElement from "../components/ClickableElement"
function labelWithoutNumber(s) {
function labelWithoutNumber (s) {
const i = s.indexOf(" (")
if (i === -1) {
if (i === -1) {
return s
}
return s.substr(0,i)
return s.substr(0, i)
}
function labelOnlyNumber(s) {
function labelOnlyNumber (s) {
const i = s.indexOf(" (")
if (i === -1) {
if (i === -1) {
return ""
}
return s.substr(i)
......@@ -167,18 +167,18 @@ class SearchResult extends React.Component {
}
renderSeries (result) {
if (result.seriesLabel.length > 0) {
return (
<p key="series" className="series">
<strong><FormattedMessage {...messages.series} /></strong>&nbsp;
{result.seriesLabel.map((series, i) => (
<span key={series} >
<Link to={fieldQueryLink("series", labelWithoutNumber(series))}>{labelWithoutNumber(series)}</Link>{labelOnlyNumber(series)}{(i < result.seriesLabel.length - 1) ? ", " : null}
</span>
))}
</p>
)
}
if (result.seriesLabel.length > 0) {
return (
<p key="series" className="series">
<strong><FormattedMessage {...messages.series} /></strong>&nbsp;
{result.seriesLabel.map((series, i) => (
<span key={series} >
<Link to={fieldQueryLink("series", labelWithoutNumber(series))}>{labelWithoutNumber(series)}</Link>{labelOnlyNumber(series)}{(i < result.seriesLabel.length - 1) ? ", " : null}
</span>
))}
</p>
)
}
}
getResultItems () {
......
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