Skip to content

Commit

Permalink
Add name to PageHeadDeleteModal
Browse files Browse the repository at this point in the history
  • Loading branch information
jochenklar committed Jan 16, 2025
1 parent 4074a84 commit 0821cfc
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,7 @@ const PageHead = ({ templates, page, sets, values, currentSet,
}
<PageHeadDeleteModal
title={capitalize(page.verbose_name)}
name={currentSetValue.text}
show={showDeleteModal}
onClose={closeDeleteModal}
onSubmit={handleDeleteSet}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,19 @@ import PropTypes from 'prop-types'

import Modal from 'rdmo/core/assets/js/components/Modal'

const PageHeadDeleteModal = ({ title, show, onClose, onSubmit }) => {
const PageHeadDeleteModal = ({ title, name, show, onClose, onSubmit }) => {
return (
<Modal title={title} show={show} submitLabel={gettext('Delete')} submitProps={{className: 'btn btn-danger'}}
onClose={onClose} onSubmit={onSubmit}>
<p>{gettext('You are about to permanently delete this tab.')}</p>
{
name ? (
<p dangerouslySetInnerHTML={{
__html: interpolate(gettext('You are about to permanently delete the tab named: <strong>%s</strong>'), [name])
}}></p>
) : (
<p>{gettext('You are about to permanently delete this tab.')}</p>
)
}
<p>{gettext('This includes all given answers for this tab on all pages, not just this one.')}</p>
<p className="text-danger">{gettext('This action cannot be undone!')}</p>
</Modal>
Expand All @@ -16,6 +24,7 @@ const PageHeadDeleteModal = ({ title, show, onClose, onSubmit }) => {

PageHeadDeleteModal.propTypes = {
title: PropTypes.string.isRequired,
name: PropTypes.string,
show: PropTypes.bool.isRequired,
onClose: PropTypes.func.isRequired,
onSubmit: PropTypes.func.isRequired,
Expand Down

0 comments on commit 0821cfc

Please sign in to comment.