Skip to content
This repository has been archived by the owner on Dec 13, 2020. It is now read-only.

Commit

Permalink
#883 Captions are clickable
Browse files Browse the repository at this point in the history
  • Loading branch information
damianprzygodzki committed Jun 22, 2017
1 parent ae66ab5 commit 0e2126f
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 7 deletions.
8 changes: 6 additions & 2 deletions src/components/board/Card.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,8 @@ class Card extends Component {
renderCard = () => {
const {
caption, description, users, placeholder, connectDragSource,
connectDropTarget, onDelete, cardId, laneId
connectDropTarget, onDelete, cardId, laneId, onCaptionClick,
documentPath
} = this.props;

const {mouseOn} = this.state;
Expand All @@ -87,7 +88,10 @@ class Card extends Component {
className="pointer meta-icon-close-1 float-xs-right"
onClick={() => onDelete(laneId, cardId)}
/>}
<b>{caption}</b>
<b
className="pointer"
onClick={() => onCaptionClick(documentPath)}
>{caption}</b>
<p>{description}</p>
{users.map((user, i) =>
<Avatar
Expand Down
4 changes: 2 additions & 2 deletions src/components/board/Lane.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ class Lane extends Component {
render() {
const {
caption, cards, laneId, onHover, onDrop, targetIndicator, onReject,
onDelete, placeholder
onDelete, placeholder, onCaptionClick
} = this.props;

if(placeholder){
Expand All @@ -35,7 +35,7 @@ class Lane extends Component {
index={i}
{...{
laneId, onHover, onDrop, onReject, targetIndicator,
onDelete
onDelete, onCaptionClick
}}
{...card} />
)}
Expand Down
6 changes: 4 additions & 2 deletions src/components/board/Lanes.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ class Lanes extends Component {

render() {
const {
lanes, onDrop, onHover, onReject, onDelete, targetIndicator
lanes, onDrop, onHover, onReject, onDelete, targetIndicator,
onCaptionClick
} = this.props;

if(!lanes) return false;
Expand All @@ -19,7 +20,8 @@ class Lanes extends Component {
<Lane
key={i}
{...{
onDrop, onHover, onDelete, onReject, targetIndicator
onDrop, onHover, onDelete, onReject,
targetIndicator, onCaptionClick
}}
{...lane}
/>)
Expand Down
14 changes: 13 additions & 1 deletion src/containers/Board.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import React, { Component } from 'react';
import PropTypes from 'prop-types';
import {connect} from 'react-redux';
import update from 'immutability-helper';
import {push} from 'react-router-redux';

import {getData, patchRequest, deleteRequest} from '../actions/GenericActions';
import {connectWS, disconnectWS} from '../actions/WindowActions';
Expand Down Expand Up @@ -131,6 +132,16 @@ class Board extends Component {
}
}));
}

handleCaptionClick = (docPath) => {
const {dispatch} = this.props;
if(!docPath) return;

dispatch(push(
'/window/' + docPath.windowId +
(docPath.documentId ? '/' + docPath.documentId : '')
))
}

handleDelete = (laneId, cardId) => {
const {board} = this.state;
Expand All @@ -151,7 +162,7 @@ class Board extends Component {

render() {
const {
modal, rawModal, breadcrumb, indicator
modal, rawModal, breadcrumb, indicator, dispatch
} = this.props;

const {
Expand Down Expand Up @@ -193,6 +204,7 @@ class Board extends Component {
onHover={this.handleHover}
onReject={this.clearTargetIndicator}
onDelete={this.handleDelete}
onCaptionClick={this.handleCaptionClick}
lanes={board && board.lanes}
/>
</div>
Expand Down

0 comments on commit 0e2126f

Please sign in to comment.