Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

MINOR Removed $('.cms-content').loadForm(), its very similar to loadP…

…anel() - accepts callbacks, but that's not specific to forms. Listen to 'afterstatechange' rather than 'loadform' events
  • Loading branch information...
commit e2df1f4c5f1c5983f1349419c1f1c177f180620d 1 parent b025b95
Ingo Schommer chillu authored
2  admin/javascript/LeftAndMain.AddForm.js
View
@@ -89,7 +89,7 @@
data.push({name:button.attr('name'),value:button.val()});
// TODO Should be set by hiddenfield already
- jQuery('.cms-content').entwine('ss').loadForm(
+ jQuery('.cms-content').entwine('ss').submitForm(
this.attr('action'),
null,
function() {
72 admin/javascript/LeftAndMain.Content.js
View
@@ -27,78 +27,6 @@
},
/**
- * Function: loadForm
- *
- * See $('.cms-container').loadPanel() on a frequently used alternative
- * to direct ajax loading of content, with support for the window.History object.
- *
- * Parameters:
- * (String) url - ..
- * (Function) callback - (Optional) Called after the form content as been loaded
- * (Object) ajaxOptions - Object literal merged into the jQuery.ajax() call (Optional)
- *
- * Returns:
- * (XMLHTTPRequest)
- */
- loadForm: function(url, form, callback, ajaxOptions) {
- var self = this;
- if(!form || !form.length) {
- var form = $('.cms-content-fields form:first', self);
- if(form.length == 0) form = $('.cms-content-fields').parents("form").eq(0);
- }
-
- // Alert when unsaved changes are present
- if(!form.confirmUnsavedChanges()) return false;
-
- // hide existing form - shown again through _loadResponse()
- form.addClass('loading');
-
- this.trigger('loadform', {form: form, url: url});
-
- var opts = jQuery.extend({}, {
- // Ensure that form view is loaded (rather than whole "Content" template)
- headers: {"X-Pjax" : "CurrentForm"},
- url: url,
- complete: function(xmlhttp, status) {
- self.loadForm_responseHandler(form, xmlhttp.responseText, status, xmlhttp);
- if(callback) callback.apply(self, arguments);
- },
- dataType: 'html'
- }, ajaxOptions);
-
- return jQuery.ajax(opts);
- },
-
- /**
- * Function: loadForm_responseHandler
- *
- * Loads the response into the DOM provided. Assumes oldForm is contains
- * the form tag to replace. If oldForm isn't present in the DOM, such as
- * if this form is only shown after click, append the whole form.
- *
- * Parameters:
- * (String) oldForm - HTML or eval'd javascript
- * (String) html - HTML to replace oldForm
- * (String) status
- * (XMLHTTPRequest) xmlhttp
- */
- loadForm_responseHandler: function(oldForm, html, status, xmlhttp) {
- if(!html) return;
-
- if(oldForm.length > 0) {
- oldForm.replaceWith(html); // triggers onmatch() on form
- } else {
- $('.cms-content').append(html);
- }
-
- // redraw the layout.
- jQuery('.cms-container').entwine('ss').redraw();
-
- // set status message based on response
- var _statusMessage = (xmlhttp.getResponseHeader('X-Status')) ? xmlhttp.getResponseHeader('X-Status') : xmlhttp.statusText;
- },
-
- /**
* Function: ajaxSubmit
*
* Parameters:
3  admin/javascript/LeftAndMain.js
View
@@ -194,9 +194,6 @@ jQuery.noConflict();
* For example, a ModelAdmin search event should contain the search terms
* as URL parameters, and the result display should automatically appear
* if the URL is loaded without ajax.
- *
- * Alternatively, you can load new content via $('.cms-content').loadForm(<url>).
- * In this case, the action won't be recorded in the browser history.
*/
handleStateChange: function() {
var self = this, h = window.History, state = h.getState();
3  docs/en/reference/cms-architecture.md
View
@@ -176,8 +176,7 @@ should be placed in jQuery.entinwe `onmatch()` rules which apply to the newly cr
See `$('.cms-container').handleStateChange()` in `LeftAndMain.js` for details.
Alternatively, form-related Ajax calls can be invoked through their own wrappers,
-which don't cause history events and hence allow callbacks: `$('.cms-content').loadForm()`
-and `$('.cms-content').submitForm()`.
+which don't cause history events and hence allow callbacks: `$('.cms-content').submitForm()`.
Within the PHP logic, the `[api:PjaxResponseNegotiator]` class determines which view is rendered.
Through a custom `X-Pjax` HTTP header, the client can declare which view he's expecting,
Please sign in to comment.
Something went wrong with that request. Please try again.