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

fix(reports): fix show more/less by adding id

parent a78b69da
No related branches found
No related tags found
1 merge request!10Sprint #12
......@@ -50,7 +50,7 @@ const ReviewReportCard = ({
<Label>Report Text</Label>
</Row>
<Row>
<ShowMore content={publicComment.content} />
<ShowMore content={publicComment.content} id="public-content" />
</Row>
</Fragment>
)}
......@@ -77,7 +77,7 @@ const ReviewReportCard = ({
<Label>Confidential Note</Label>
</Row>
<Row>
<ShowMore content={privateComment.content} />
<ShowMore content={privateComment.content} id="private-content" />
</Row>
</Fragment>
)}
......
......@@ -2,14 +2,14 @@ import React, { Fragment } from 'react'
import { Icon } from '@pubsweet/ui'
import styled from 'styled-components'
const ShowMore = ({ content = '', words = 50 }) => {
const ShowMore = ({ content = '', words = 50, id = 'read-more-target' }) => {
const contentSize = content.split(' ').length
return (
<Root>
{contentSize > words && (
<Fragment>
<Input id="read-more-target" role="button" type="checkbox" />
<Control htmlFor="read-more-target">
<Input id={id} role="button" type="checkbox" />
<Control htmlFor={id}>
<div>
<Icon primary>chevron-down</Icon> Show All
</div>
......@@ -73,6 +73,7 @@ const Input = styled.input`
const Control = styled.label`
cursor: pointer;
width: fit-content;
div {
text-decoration: underline;
text-transform: uppercase;
......
......@@ -144,11 +144,11 @@ const onChange = (
dispatch(autosaveRequest())
if (newValues.id) {
updateRecommendation(project.id, version.id, newValues)
.then(r => dispatch(autosaveSuccess(r.updatedOn)))
.then(r => dispatch(autosaveSuccess(get(r, 'updatedOn'))))
.catch(e => dispatch(autosaveFailure(e)))
} else {
createRecommendation(project.id, version.id, newValues)
.then(r => dispatch(autosaveSuccess(r.updatedOn)))
.then(r => dispatch(autosaveSuccess(get(r, 'updatedOn'))))
.catch(e => dispatch(autosaveFailure(e)))
}
}
......@@ -177,7 +177,7 @@ export const onReviewSubmit = (
newValues.submittedOn = Date.now()
dispatch(autosaveRequest())
updateRecommendation(project.id, version.id, newValues)
.then(r => dispatch(autosaveSuccess(r.updatedOn)))
.then(r => dispatch(autosaveSuccess(get(r, 'updatedOn'))))
.then(hideModal)
},
onCancel: hideModal,
......
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