Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

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
  • Loading branch information...
commit 51ff4004d1b48955baded2bb0d08ee5772193448 1 parent e5ade1b
Ingo Schommer chillu authored
Showing with 10 additions and 1 deletion.
  1. +10 −1 admin/javascript/LeftAndMain.Content.js
11 admin/javascript/LeftAndMain.Content.js
View
@@ -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
Please sign in to comment.
Something went wrong with that request. Please try again.