Skip to content

Commit

Permalink
[TASK] Simplify modal callback handling
Browse files Browse the repository at this point in the history
The fix from #84499 can be simplified a bit: class
"modal-content-loaded" is not needed with the callback
solution.

Resolves: #84559
Related: #84499
Releases: master
Change-Id: I2900ecafc06579076670f8678471530d03d0b63c
Reviewed-on: https://review.typo3.org/56477
Reviewed-by: Andreas Fernandez <a.fernandez@scripting-base.de>
Tested-by: Andreas Fernandez <a.fernandez@scripting-base.de>
Tested-by: TYPO3com <no-reply@typo3.com>
Reviewed-by: Frank Naegler <frank.naegler@typo3.org>
Tested-by: Frank Naegler <frank.naegler@typo3.org>
  • Loading branch information
lolli42 authored and NeoBlack committed Mar 29, 2018
1 parent fd1c712 commit b9026a9
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 20 deletions.
35 changes: 16 additions & 19 deletions typo3/sysext/backend/Resources/Private/TypeScript/Modal.ts
Expand Up @@ -343,25 +343,22 @@ class Modal {
if (configuration.type === 'ajax') {
const contentTarget = configuration.ajaxTarget ? configuration.ajaxTarget : Identifiers.body;
const $loaderTarget = currentModal.find(contentTarget);
if (!$loaderTarget.hasClass('modal-content-loaded')) {
Icons.getIcon('spinner-circle', Icons.sizes.default, null, null, Icons.markupIdentifiers.inline).done((icon: string): void => {
$loaderTarget.html('<div class="modal-loading">' + icon + '</div>');
$.get(
<string>configuration.content,
(response: string): void => {
this.currentModal.find(contentTarget)
.addClass('modal-content-loaded')
.empty()
.append(response);
if (configuration.ajaxCallback) {
configuration.ajaxCallback();
}
this.currentModal.trigger('modal-loaded');
},
'html'
);
});
}
Icons.getIcon('spinner-circle', Icons.sizes.default, null, null, Icons.markupIdentifiers.inline).done((icon: string): void => {
$loaderTarget.html('<div class="modal-loading">' + icon + '</div>');
$.get(
<string>configuration.content,
(response: string): void => {
this.currentModal.find(contentTarget)
.empty()
.append(response);
if (configuration.ajaxCallback) {
configuration.ajaxCallback();
}
this.currentModal.trigger('modal-loaded');
},
'html'
);
});
} else if (configuration.type === 'iframe') {
currentModal.find(Identifiers.body).append(
$('<iframe />', {
Expand Down
2 changes: 1 addition & 1 deletion typo3/sysext/backend/Resources/Public/JavaScript/Modal.js

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

0 comments on commit b9026a9

Please sign in to comment.