From 77d7423cb269f65a9bed24bc7deadd4799041f90 Mon Sep 17 00:00:00 2001 From: Chris Macklin Date: Tue, 1 Oct 2019 16:24:30 -0700 Subject: [PATCH 1/4] Provide props to customize Confirm title and content for delete button. --- .../ra-ui-materialui/src/button/DeleteWithConfirmButton.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/packages/ra-ui-materialui/src/button/DeleteWithConfirmButton.js b/packages/ra-ui-materialui/src/button/DeleteWithConfirmButton.js index 64bb0577f0e..2693710b570 100644 --- a/packages/ra-ui-materialui/src/button/DeleteWithConfirmButton.js +++ b/packages/ra-ui-materialui/src/button/DeleteWithConfirmButton.js @@ -53,6 +53,8 @@ const DeleteWithConfirmButton = ({ className, icon, label = 'ra.action.delete', + confirmTitle = 'ra.message.delete_title', + confirmContent = 'ra.message.delete_content', onClick, record, resource, @@ -127,8 +129,8 @@ const DeleteWithConfirmButton = ({ Date: Tue, 1 Oct 2019 16:26:24 -0700 Subject: [PATCH 2/4] Provide props to customize Confirm title and content for delete buttons. --- .../src/button/BulkDeleteWithConfirmButton.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/packages/ra-ui-materialui/src/button/BulkDeleteWithConfirmButton.js b/packages/ra-ui-materialui/src/button/BulkDeleteWithConfirmButton.js index 160e0377f63..401c699da52 100644 --- a/packages/ra-ui-materialui/src/button/BulkDeleteWithConfirmButton.js +++ b/packages/ra-ui-materialui/src/button/BulkDeleteWithConfirmButton.js @@ -46,6 +46,8 @@ const BulkDeleteWithConfirmButton = ({ crudDeleteMany, icon, label, + confirmTitle = 'ra.message.bulk_delete_title', + confirmContent = 'ra.message.bulk_delete_content', onClick, resource, selectedIds, @@ -105,8 +107,8 @@ const BulkDeleteWithConfirmButton = ({ Date: Tue, 1 Oct 2019 16:28:48 -0700 Subject: [PATCH 3/4] Re-order props to comply with apparent alphabetical ordering. --- .../src/button/BulkDeleteWithConfirmButton.js | 4 ++-- .../ra-ui-materialui/src/button/DeleteWithConfirmButton.js | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/ra-ui-materialui/src/button/BulkDeleteWithConfirmButton.js b/packages/ra-ui-materialui/src/button/BulkDeleteWithConfirmButton.js index 401c699da52..8b69963b0cb 100644 --- a/packages/ra-ui-materialui/src/button/BulkDeleteWithConfirmButton.js +++ b/packages/ra-ui-materialui/src/button/BulkDeleteWithConfirmButton.js @@ -43,11 +43,11 @@ const useStyles = makeStyles(theme => ({ const BulkDeleteWithConfirmButton = ({ basePath, classes: classesOverride, + confirmTitle = 'ra.message.bulk_delete_title', + confirmContent = 'ra.message.bulk_delete_content', crudDeleteMany, icon, label, - confirmTitle = 'ra.message.bulk_delete_title', - confirmContent = 'ra.message.bulk_delete_content', onClick, resource, selectedIds, diff --git a/packages/ra-ui-materialui/src/button/DeleteWithConfirmButton.js b/packages/ra-ui-materialui/src/button/DeleteWithConfirmButton.js index 2693710b570..65b2a04647d 100644 --- a/packages/ra-ui-materialui/src/button/DeleteWithConfirmButton.js +++ b/packages/ra-ui-materialui/src/button/DeleteWithConfirmButton.js @@ -51,10 +51,10 @@ const DeleteWithConfirmButton = ({ basePath, classes: classesOverride, className, - icon, - label = 'ra.action.delete', confirmTitle = 'ra.message.delete_title', confirmContent = 'ra.message.delete_content', + icon, + label = 'ra.action.delete', onClick, record, resource, From 8fe5522c5786b295ebaf7aa34eaf33397e964f0e Mon Sep 17 00:00:00 2001 From: Chris Macklin Date: Thu, 3 Oct 2019 11:11:03 -0700 Subject: [PATCH 4/4] Move confim defaults into DefaultProps and add PropTypes. --- .../src/button/BulkDeleteWithConfirmButton.js | 8 ++++++-- .../src/button/DeleteWithConfirmButton.js | 2 ++ 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/packages/ra-ui-materialui/src/button/BulkDeleteWithConfirmButton.js b/packages/ra-ui-materialui/src/button/BulkDeleteWithConfirmButton.js index 8b69963b0cb..4ea3de5cdb4 100644 --- a/packages/ra-ui-materialui/src/button/BulkDeleteWithConfirmButton.js +++ b/packages/ra-ui-materialui/src/button/BulkDeleteWithConfirmButton.js @@ -43,8 +43,8 @@ const useStyles = makeStyles(theme => ({ const BulkDeleteWithConfirmButton = ({ basePath, classes: classesOverride, - confirmTitle = 'ra.message.bulk_delete_title', - confirmContent = 'ra.message.bulk_delete_content', + confirmTitle, + confirmContent, crudDeleteMany, icon, label, @@ -129,6 +129,8 @@ const BulkDeleteWithConfirmButton = ({ BulkDeleteWithConfirmButton.propTypes = { basePath: PropTypes.string, classes: PropTypes.object, + confirmTitle: PropTypes.string, + confirmContent: PropTypes.string, label: PropTypes.string, resource: PropTypes.string.isRequired, selectedIds: PropTypes.arrayOf(PropTypes.any).isRequired, @@ -136,6 +138,8 @@ BulkDeleteWithConfirmButton.propTypes = { }; BulkDeleteWithConfirmButton.defaultProps = { + confirmTitle: 'ra.message.bulk_delete_title', + confirmContent: 'ra.message.bulk_delete_content', label: 'ra.action.delete', icon: , }; diff --git a/packages/ra-ui-materialui/src/button/DeleteWithConfirmButton.js b/packages/ra-ui-materialui/src/button/DeleteWithConfirmButton.js index 65b2a04647d..5902f02d8ff 100644 --- a/packages/ra-ui-materialui/src/button/DeleteWithConfirmButton.js +++ b/packages/ra-ui-materialui/src/button/DeleteWithConfirmButton.js @@ -152,6 +152,8 @@ DeleteWithConfirmButton.propTypes = { basePath: PropTypes.string, classes: PropTypes.object, className: PropTypes.string, + confirmTitle: PropTypes.string, + confirmContent: PropTypes.string, label: PropTypes.string, record: PropTypes.object, redirect: PropTypes.oneOfType([