Skip to content

Commit d4ca743

Browse files
authored
Merge pull request #3934 from PrakashDurlabhji/issue_3868_1
Issue #3868 fix
2 parents 21d7515 + 49ead23 commit d4ca743

File tree

2 files changed

+12
-4
lines changed

2 files changed

+12
-4
lines changed

src/projects/components/projectsCard/ProjectCardBody.jsx

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import React from 'react'
22
import PT from 'prop-types'
33
import TextTruncate from 'react-text-truncate'
4-
import { Link } from 'react-router-dom'
4+
import { withRouter } from 'react-router-dom'
55
import ProjectStatus from '../../../components/ProjectStatus/ProjectStatus'
66
import editableProjectStatus from '../../../components/ProjectStatus/editableProjectStatus'
77
import {
@@ -17,7 +17,7 @@ import _ from 'lodash'
1717
const EnhancedProjectStatus = editableProjectStatus(ProjectStatus)
1818

1919
function ProjectCardBody({ project, projectCanBeActive, currentMemberRole, descLinesCount = 8,
20-
onChangeStatus, isSuperUser, showLink, showLinkURL, canEditStatus = true, hideStatus }) {
20+
onChangeStatus, isSuperUser, showLink, showLinkURL, canEditStatus = true, hideStatus, history }) {
2121
if (!project) return null
2222

2323
const canEdit = canEditStatus && (
@@ -31,6 +31,13 @@ function ProjectCardBody({ project, projectCanBeActive, currentMemberRole, descL
3131
], currentMemberRole) > -1)))
3232
)
3333

34+
const goToProjectDetails = (evt, showLinkURL, projectDetailsURL) => {
35+
evt.stopPropagation()
36+
evt.preventDefault()
37+
evt.nativeEvent.stopImmediatePropagation()
38+
history.push(showLinkURL || projectDetailsURL)
39+
}
40+
3441
const progress = _.get(process, 'percent', 0)
3542

3643
const projectDetailsURL = project.version === 'v3'
@@ -44,7 +51,7 @@ function ProjectCardBody({ project, projectCanBeActive, currentMemberRole, descL
4451
line={descLinesCount}
4552
truncateText="..."
4653
text={_.unescape(project.description)}
47-
textTruncateChild={showLink ? <Link className="read-more-link" to={showLinkURL || projectDetailsURL}>read more</Link> : <span className="read-more-link">read more</span>}
54+
textTruncateChild={showLink ? <span className="read-more-link" onClick={(evt) => { goToProjectDetails(evt, showLinkURL, projectDetailsURL) }}>read more</span> : <span className="read-more-link">read more</span>}
4855
/>
4956
{!hideStatus && <div className="project-status">
5057
{(project.status !== PROJECT_STATUS_ACTIVE || progress === 0) &&
@@ -82,4 +89,4 @@ ProjectCardBody.propTypes = {
8289
hideStatus: PT.bool
8390
}
8491

85-
export default ProjectCardBody
92+
export default withRouter(ProjectCardBody)

src/projects/components/projectsCard/ProjectCardBody.scss

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
.read-more-link {
1414
white-space: nowrap;
1515
color: $tc-dark-blue;
16+
cursor: pointer;
1617
}
1718
}
1819

0 commit comments

Comments
 (0)