mirror of
https://github.com/vale981/Vulcan
synced 2025-03-05 17:41:43 -05:00
showEdit on Card
This make the Card consistent with the Datatable, and allow to hide the `edit` button on cards using the `showEdit` prop.
This commit is contained in:
parent
af4c44a2af
commit
e85bbab894
1 changed files with 4 additions and 3 deletions
|
@ -119,10 +119,10 @@ const CardEditForm = ({ collection, document, closeModal }) =>
|
|||
}}
|
||||
/>
|
||||
|
||||
const Card = ({className, collection, document, currentUser, fields}, {intl}) => {
|
||||
const Card = ({className, collection, document, currentUser, fields, showEdit = true}, {intl}) => {
|
||||
|
||||
const fieldNames = fields ? fields : _.without(_.keys(document), '__typename');
|
||||
const canEdit = currentUser && collection.options.mutations.edit.check(currentUser, document);
|
||||
const canEdit = showEdit && currentUser && collection.options.mutations.edit.check(currentUser, document);
|
||||
|
||||
return (
|
||||
<div className={classNames(className, 'datacard', `datacard-${collection._name}`)}>
|
||||
|
@ -146,10 +146,11 @@ Card.propTypes = {
|
|||
document: PropTypes.object,
|
||||
currentUser: PropTypes.object,
|
||||
fields: PropTypes.array,
|
||||
showEdit: PropTypes.bool
|
||||
}
|
||||
|
||||
Card.contextTypes = {
|
||||
intl: intlShape
|
||||
}
|
||||
|
||||
registerComponent('Card', Card);
|
||||
registerComponent('Card', Card);
|
||||
|
|
Loading…
Add table
Reference in a new issue