diff --git a/imports/ui/components/DocumentsList.js b/imports/ui/components/DocumentsList.js index 93e91e3..2c36e26 100644 --- a/imports/ui/components/DocumentsList.js +++ b/imports/ui/components/DocumentsList.js @@ -1,10 +1,17 @@ import React from 'react'; +import { browserHistory } from 'react-router'; import { ListGroup, ListGroupItem, Alert } from 'react-bootstrap'; +const handleNav = (_id) => { + browserHistory.push(`/documents/${_id}`); +} + const DocumentsList = ({ documents }) => ( documents.length > 0 ? {documents.map(({ _id, title }) => ( - { title } + handleNav(_id) }> + { title } + ))} : No documents yet. diff --git a/imports/ui/pages/Documents.js b/imports/ui/pages/Documents.js index 6979193..f5a12fd 100644 --- a/imports/ui/pages/Documents.js +++ b/imports/ui/pages/Documents.js @@ -1,7 +1,13 @@ import React from 'react'; +import { browserHistory } from 'react-router'; import { Row, Col, Button } from 'react-bootstrap'; import DocumentsList from '../containers/DocumentsList.js'; +const buttonNav = (event) => { + event.preventDefault(); + browserHistory.push('/documents/new'); +} + const Documents = () => (
@@ -11,7 +17,7 @@ const Documents = () => (
diff --git a/imports/ui/pages/ViewDocument.js b/imports/ui/pages/ViewDocument.js index f3f7183..48202a1 100644 --- a/imports/ui/pages/ViewDocument.js +++ b/imports/ui/pages/ViewDocument.js @@ -4,6 +4,10 @@ import { browserHistory } from 'react-router'; import { Bert } from 'meteor/themeteorchef:bert'; import { removeDocument } from '../../api/documents/methods.js'; +const handleEdit = (_id) => { + browserHistory.push(`/documents/${_id}/edit`); +} + const handleRemove = (_id) => { if (confirm('Are you sure? This is permanent!')) { removeDocument.call({ _id }, (error) => { @@ -23,7 +27,7 @@ const ViewDocument = ({ doc }) => (

{ doc.title }

- +