summaryrefslogtreecommitdiff
path: root/misc
diff options
context:
space:
mode:
authorDries Buytaert <dries@buytaert.net>2010-10-21 19:31:39 +0000
committerDries Buytaert <dries@buytaert.net>2010-10-21 19:31:39 +0000
commit3cbd47d1458b9914d0ede84fd31d4ecc0c8e684b (patch)
tree5818038bc57b05fdcfa8b23fbf43e69f148f5f8b /misc
parent2a0e32644822d34416f4633b4c6fc8674870e6d8 (diff)
downloadbrdo-3cbd47d1458b9914d0ede84fd31d4ecc0c8e684b.tar.gz
brdo-3cbd47d1458b9914d0ede84fd31d4ecc0c8e684b.tar.bz2
- Patch #647228 by sun, katbailey, Rob Loach: links are needlessly unable to fully participate in D7 AJAX framework features.
Diffstat (limited to 'misc')
-rw-r--r--misc/ajax.js33
1 files changed, 19 insertions, 14 deletions
diff --git a/misc/ajax.js b/misc/ajax.js
index 773986ae3..570e2aaed 100644
--- a/misc/ajax.js
+++ b/misc/ajax.js
@@ -176,6 +176,7 @@ Drupal.ajax = function (base, element, element_settings) {
ajax.form.ajaxSubmit(ajax.options);
}
else {
+ ajax.beforeSerialize(ajax.element, ajax.options);
$.ajax(ajax.options);
}
}
@@ -216,31 +217,35 @@ Drupal.ajax.prototype.beforeSerialize = function (element, options) {
var settings = this.settings || Drupal.settings;
Drupal.detachBehaviors(this.form, settings, 'serialize');
}
-};
-
-/**
- * Handler for the form redirection submission.
- */
-Drupal.ajax.prototype.beforeSubmit = function (form_values, element, options) {
- // Disable the element that received the change.
- $(this.element).addClass('progress-disabled').attr('disabled', true);
// Prevent duplicate HTML ids in the returned markup.
// @see drupal_html_id()
+ options.data['ajax_html_ids[]'] = [];
$('[id]').each(function () {
- form_values.push({ name: 'ajax_html_ids[]', value: this.id });
+ options.data['ajax_html_ids[]'].push(this.id);
});
// Allow Drupal to return new JavaScript and CSS files to load without
// returning the ones already loaded.
- form_values.push({ name: 'ajax_page_state[theme]', value: Drupal.settings.ajaxPageState.theme });
- form_values.push({ name: 'ajax_page_state[theme_token]', value: Drupal.settings.ajaxPageState.themeToken });
+ // @see ajax_base_page_theme()
+ // @see drupal_get_css()
+ // @see drupal_get_js()
+ options.data['ajax_page_state[theme]'] = Drupal.settings.ajaxPageState.theme;
+ options.data['ajax_page_state[theme_token]'] = Drupal.settings.ajaxPageState.theme_token;
for (var key in Drupal.settings.ajaxPageState.css) {
- form_values.push({ name: 'ajax_page_state[css][' + key + ']', value: 1 });
+ options.data['ajax_page_state[css][' + key + ']'] = 1;
}
for (var key in Drupal.settings.ajaxPageState.js) {
- form_values.push({ name: 'ajax_page_state[js][' + key + ']', value: 1 });
+ options.data['ajax_page_state[js][' + key + ']'] = 1;
}
+};
+
+/**
+ * Handler for the form redirection submission.
+ */
+Drupal.ajax.prototype.beforeSubmit = function (form_values, element, options) {
+ // Disable the element that received the change.
+ $(this.element).addClass('progress-disabled').attr('disabled', true);
// Insert progressbar or throbber.
if (this.progress.type == 'bar') {
@@ -279,7 +284,7 @@ Drupal.ajax.prototype.success = function (response, status) {
Drupal.freezeHeight();
- for (i in response) {
+ for (var i in response) {
if (response[i]['command'] && this.commands[response[i]['command']]) {
this.commands[response[i]['command']](this, response[i], status);
}