Skip to content

Commit

Permalink
Merge pull request #3760 from macklin-10x/next
Browse files Browse the repository at this point in the history
Adds props to allow customizing the title and content of Confirm modals for delete buttons.
  • Loading branch information
fzaninotto authored Nov 21, 2019
2 parents 98db912 + 8fe5522 commit 315b3ee
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ const useStyles = makeStyles(theme => ({
const BulkDeleteWithConfirmButton = ({
basePath,
classes: classesOverride,
confirmTitle,
confirmContent,
crudDeleteMany,
icon,
label,
Expand Down Expand Up @@ -105,8 +107,8 @@ const BulkDeleteWithConfirmButton = ({
<Confirm
isOpen={isOpen}
loading={loading}
title="ra.message.bulk_delete_title"
content="ra.message.bulk_delete_content"
title={confirmTitle}
content={confirmContent}
translateOptions={{
smart_count: selectedIds.length,
name: inflection.humanize(
Expand All @@ -127,13 +129,17 @@ 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,
icon: PropTypes.element,
};

BulkDeleteWithConfirmButton.defaultProps = {
confirmTitle: 'ra.message.bulk_delete_title',
confirmContent: 'ra.message.bulk_delete_content',
label: 'ra.action.delete',
icon: <ActionDelete />,
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@ const DeleteWithConfirmButton = ({
basePath,
classes: classesOverride,
className,
confirmTitle = 'ra.message.delete_title',
confirmContent = 'ra.message.delete_content',
icon,
label = 'ra.action.delete',
onClick,
Expand Down Expand Up @@ -123,8 +125,8 @@ const DeleteWithConfirmButton = ({
<Confirm
isOpen={open}
loading={loading}
title="ra.message.delete_title"
content="ra.message.delete_content"
title={confirmTitle}
content={confirmContent}
translateOptions={{
name: inflection.humanize(
translate(`resources.${resource}.name`, {
Expand All @@ -146,6 +148,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([
Expand Down

0 comments on commit 315b3ee

Please sign in to comment.