mirror of
https://github.com/Icinga/icingaweb2.git
synced 2025-07-29 16:54:04 +02:00
js: Make use of the _frameUpload parameter when submitting a form..
..to an iframe. This ensures that stuff like notifications are immediately visible to the user after successful form submission. refs #8758
This commit is contained in:
parent
fc481e527b
commit
9471c3c574
@ -151,20 +151,26 @@
|
|||||||
var self = this;
|
var self = this;
|
||||||
|
|
||||||
$form.prop('action', self.icinga.utils.addUrlParams(action, {
|
$form.prop('action', self.icinga.utils.addUrlParams(action, {
|
||||||
'_disableLayout': true
|
'_frameUpload': true
|
||||||
}));
|
}));
|
||||||
$form.prop('target', 'fileupload-frame-target');
|
$form.prop('target', 'fileupload-frame-target');
|
||||||
$('#fileupload-frame-target').on('load', function (event) {
|
$('#fileupload-frame-target').on('load', function (event) {
|
||||||
var $frame = $(event.target);
|
var $frame = $(event.target);
|
||||||
|
var $contents = $frame.contents();
|
||||||
|
|
||||||
// Fetch the frame's new content, paste it into the target..
|
var $redirectMeta = $contents.find('meta[name="redirectUrl"]');
|
||||||
self.renderContentToContainer(
|
if ($redirectMeta.length) {
|
||||||
$frame.contents().find('body').html(),
|
self.loadUrl($redirectMeta.attr('content'), $target);
|
||||||
$target,
|
} else {
|
||||||
'replace'
|
// Fetch the frame's new content and paste it into the target
|
||||||
);
|
self.renderContentToContainer(
|
||||||
$frame.prop('src', 'about:blank'); // ..and clear the frame's dom
|
$contents.find('body').html(),
|
||||||
|
$target,
|
||||||
|
'replace'
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
$frame.prop('src', 'about:blank'); // Clear the frame's dom
|
||||||
$frame.off('load'); // Unbind the event as it's set on demand
|
$frame.off('load'); // Unbind the event as it's set on demand
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
Loading…
x
Reference in New Issue
Block a user