mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
ENHANCEMENT Allowing ajax responses on CMS form submissions to "break out" of the form element they were triggered through, by looking for existence of ".cms-content" node in response
This commit is contained in:
parent
e5ade1ba12
commit
51ff4004d1
@ -197,7 +197,16 @@
|
||||
*/
|
||||
submitForm_responseHandler: function(oldForm, data, status, xmlhttp, origData) {
|
||||
if(status == 'success') {
|
||||
var form = this.replaceForm(oldForm, data);
|
||||
var form, newContent = $(data);
|
||||
|
||||
// HACK If response contains toplevel panel rather than a form, replace it instead.
|
||||
// For example, a page view shows tree + edit form. Deleting this page redirects to
|
||||
// the "pages" overview, which doesn't have a separate tree panel.
|
||||
if(newContent.is('.cms-content')) {
|
||||
$('.cms-content').replaceWith(newContent);
|
||||
} else {
|
||||
form = this.replaceForm(oldForm, newContent);
|
||||
}
|
||||
|
||||
if(typeof(Behaviour) != 'undefined') Behaviour.apply(); // refreshes ComplexTableField
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user