Skip to content
Snippets Groups Projects
Commit 311ebc61 authored by Bogdan Cochior's avatar Bogdan Cochior
Browse files

Parse title and remove <p> tags

parent ed150e66
No related branches found
No related tags found
No related merge requests found
...@@ -3,20 +3,24 @@ import { get, find } from 'lodash' ...@@ -3,20 +3,24 @@ import { get, find } from 'lodash'
import moment from 'moment' import moment from 'moment'
import { Icon } from '@pubsweet/ui' import { Icon } from '@pubsweet/ui'
import { parseTitle } from './utils'
import classes from './Dashboard.local.scss' import classes from './Dashboard.local.scss'
const DashboardCard = ({ project, listView, version }) => { const DashboardCard = ({ project, listView, version }) => {
const author = find(get(version, 'authors'), a => a.isSubmitting) const author = find(get(version, 'authors'), a => a.isSubmitting)
const submitted = get(version, 'submitted') const submitted = get(version, 'submitted')
const title = parseTitle(version)
// const abstract = get(version, 'metadata.abstract') // const abstract = get(version, 'metadata.abstract')
const type = get(version, 'metadata.type') const type = get(version, 'metadata.type')
return ( return (
<div className={classes.card}> <div className={classes.card}>
<div className={classes.leftSide}> <div className={classes.leftSide}>
<div className={classes.title}> <div
{get(version, 'metadata.title') || 'Untitled'} className={classes.title}
</div> dangerouslySetInnerHTML={{ __html: title }} // eslint-disable-line
/>
<div className={classes.quickInfo}> <div className={classes.quickInfo}>
<div className={classes.status}> <div className={classes.status}>
{get(project, 'status') || 'Draft'} {get(project, 'status') || 'Draft'}
......
import { get } from 'lodash'
export const parseTitle = version => {
const title = get(version, 'metadata.title')
if (title) {
return title.replace(/<p[^>]*>/g, '').replace(/<\/p>/g, '')
}
return 'Untitled'
}
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