Commit ae5e0c7a authored by Michael Oehlhof's avatar Michael Oehlhof Committed by Anja Leichsenring
Browse files

[BUGFIX] Deleting an IRRE relation does now trigger a modal

Resolves: #70127
Releases: master
Change-Id: I3e7f3576f32414ac418adf470cae267550070a78
Reviewed-on: http://review.typo3.org/43607

Reviewed-by: Frank Nägler's avatarFrank Nägler <frank.naegler@typo3.org>
Tested-by: Frank Nägler's avatarFrank Nägler <frank.naegler@typo3.org>
Reviewed-by: Anja Leichsenring's avatarAnja Leichsenring <aleichsenring@ab-softlab.de>
Tested-by: Anja Leichsenring's avatarAnja Leichsenring <aleichsenring@ab-softlab.de>
parent 165aac1b
......@@ -603,14 +603,9 @@ class InlineRecordContainer extends AbstractContainer {
|| !$isPagesTable && $calcPerms & Permission::CONTENT_EDIT
|| $isSysFileReferenceTable && $calcPerms & Permission::PAGE_EDIT)
) {
$onClick = htmlspecialchars(('if (confirm('
. GeneralUtility::quoteJSvalue($languageService->getLL('deleteWarning')) . ')) { '
. 'inline.deleteRecord(' . GeneralUtility::quoteJSvalue($nameObjectFtId) . ');'
. ' } return false;'));
$title = $languageService->sL('LLL:EXT:lang/locallang_mod_web_list.xlf:delete', TRUE);
$icon = $this->iconFactory->getIcon('actions-edit-delete', Icon::SIZE_SMALL);
$cells['delete'] = '<a class="btn btn-default" href="#" onclick="' . $onClick . '" title="' . $title
. '">' . $icon . '</a>';
$cells['delete'] = '<a href="#" class="btn btn-default t3js-editform-delete-inline-record" data-objectid="' . htmlspecialchars($nameObjectFtId) . '" title="' . $title . '">' . $icon . '</a>';
}
// "Hide/Unhide" links:
......
......@@ -595,7 +595,7 @@ define('TYPO3/CMS/Backend/FormEngine', ['jquery'], function ($) {
var title = TYPO3.lang['label.confirm.delete_record.title'] || 'Delete this record?';
var content = TYPO3.lang['label.confirm.delete_record.content'] || 'Are you sure you want to delete this record?';
var $anchorElement = $(this);
$modal = top.TYPO3.Modal.confirm(title, content, top.TYPO3.Severity.warning, [
var $modal = top.TYPO3.Modal.confirm(title, content, top.TYPO3.Severity.warning, [
{
text: TYPO3.lang['buttons.confirm.delete_record.no'] || 'No, I will continue editing',
active: true,
......@@ -617,6 +617,34 @@ define('TYPO3/CMS/Backend/FormEngine', ['jquery'], function ($) {
});
});
$(document).on('click', '.t3js-editform-delete-inline-record', function(e) {
e.preventDefault();
var title = TYPO3.lang['label.confirm.delete_record.title'] || 'Delete this record?';
var content = TYPO3.lang['label.confirm.delete_record.content'] || 'Are you sure you want to delete this record?';
var $anchorElement = $(this);
var $modal = top.TYPO3.Modal.confirm(title, content, top.TYPO3.Severity.warning, [
{
text: TYPO3.lang['buttons.confirm.delete_record.no'] || 'No, I will continue editing',
active: true,
name: 'no'
},
{
text: TYPO3.lang['buttons.confirm.delete_record.yes'] || 'Yes, delete this record',
btnClass: 'btn-warning',
name: 'yes'
}
]);
$modal.on('button.clicked', function(e) {
if (e.target.name === 'no') {
top.TYPO3.Modal.dismiss();
} else if (e.target.name === 'yes') {
var objectId = $anchorElement.data('objectid');
inline.deleteRecord(objectId);
top.TYPO3.Modal.dismiss();
}
});
});
// remember the clicked submit button. we need to know that in TBE_EDITOR.submitForm();
$(document).on('click', '.t3js-editform-submitButton', function(event) {
var $elem = $('<input />').attr('type', 'hidden').attr('name', this.name).attr('value', '1');
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment