Skip to content

Commit

Permalink
[BUGFIX] Use AjaxDataHandler to delete records from context menu
Browse files Browse the repository at this point in the history
The AjaxDataHandler is now used to invoke record deletion. This way, any
messages are passed to the response and may get rendered as
notifications.

Resolves: #88377
Releases: master, 9.5
Change-Id: I60c05a5272fec07a42cc186b1273915e0e0521db
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/61966
Tested-by: Andreas Fernandez <a.fernandez@scripting-base.de>
Tested-by: TYPO3com <noreply@typo3.com>
Tested-by: Jörg Bösche <typo3@joergboesche.de>
Tested-by: Daniel Goerz <daniel.goerz@posteo.de>
Reviewed-by: Andreas Fernandez <a.fernandez@scripting-base.de>
Reviewed-by: Jörg Bösche <typo3@joergboesche.de>
Reviewed-by: Daniel Goerz <daniel.goerz@posteo.de>
  • Loading branch information
andreaskienast authored and ervaude committed Oct 14, 2019
1 parent 213c3d3 commit 0a4890e
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@

import {SeverityEnum} from './Enum/Severity';
import * as $ from 'jquery';
import AjaxDataHandler = require('./AjaxDataHandler');
import InfoWindow = require('./InfoWindow');
import Modal = require('./Modal');
import ModuleMenu = require('./ModuleMenu');
Expand Down Expand Up @@ -213,21 +214,15 @@ class ContextMenuActions {

$modal.on('button.clicked', (e: JQueryEventObject): void => {
if (e.target.getAttribute('name') === 'delete') {
const targetUrl = top.TYPO3.settings.RecordCommit.moduleUrl
+ '&cmd[' + table + '][' + uid + '][delete]=1';

$.ajax({
url: targetUrl,
success: (): void => {
if (table === 'pages' && Viewport.NavigationContainer.PageTree) {
if (uid === top.fsMod.recentIds.web) {
let node = Viewport.NavigationContainer.PageTree.instance.nodes[0];
Viewport.NavigationContainer.PageTree.selectNode(node);
}

Viewport.NavigationContainer.PageTree.refreshTree();
const xhr = AjaxDataHandler.process('cmd[' + table + '][' + uid + '][delete]=1');
xhr.done((): void => {
if (table === 'pages' && Viewport.NavigationContainer.PageTree) {
if (uid === top.fsMod.recentIds.web) {
let node = Viewport.NavigationContainer.PageTree.instance.nodes[0];
Viewport.NavigationContainer.PageTree.selectNode(node);
}
},
Viewport.NavigationContainer.PageTree.refreshTree();
}
});
}
Modal.dismiss();
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 0a4890e

Please sign in to comment.