summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEarl Miles2009-09-09 18:21:53 (GMT)
committer Earl Miles2009-09-09 18:21:53 (GMT)
commita72a144ae900674f673870e0573047917a77eb72 (patch)
treeed4eaf4c0299aeab57b405895e3e6317e3acf704
parent95d13a40847324fad2b9feb8ca6f492738b320fe (diff)
#561788 by sirkitree: Add client side reload AJAX command.
-rw-r--r--CHANGELOG.txt3
-rw-r--r--includes/ajax.inc11
-rw-r--r--js/ajax-responder.js4
3 files changed, 17 insertions, 1 deletions
diff --git a/CHANGELOG.txt b/CHANGELOG.txt
index ff30c5e..e6e9237 100644
--- a/CHANGELOG.txt
+++ b/CHANGELOG.txt
@@ -8,7 +8,8 @@ Add a couple of support functions for ctools_set_page_token that are meant to be
#553112: dependent.js failed to set proper initial state if inside an already hidden element.
#569508 by markus_petrux: Update user_profile content type.
#558942 by Roi Danton: In wizard.inc, be sure to check cancel path if return path is not set, as noted in documentation.
-#568578 by Roger Lopez: Add client side redirect command.
+#568578 by Roger Lopez: Add client side redirect AJAX command.
+#561788 by sirkitree: Add client side reload AJAX command.
ctools 6.x-1.0
==============
diff --git a/includes/ajax.inc b/includes/ajax.inc
index 5417550..5164f42 100644
--- a/includes/ajax.inc
+++ b/includes/ajax.inc
@@ -71,6 +71,8 @@
* - redirect
* - url: The url to be redirected to. This can be an absolute URL or a Drupal path.
*
+ * - reload
+ *
* Commands are usually created with a couple of helper functions, so they
* look like this:
*
@@ -379,6 +381,15 @@ function ctools_ajax_command_redirect($url) {
}
/**
+ * Force a reload of the current page.
+ */
+function ctools_ajax_command_reload() {
+ return array(
+ 'command' => 'reload',
+ );
+}
+
+/**
* Render a commands array into JSON and immediately hand this back
* to the AJAX requester.
*/
diff --git a/js/ajax-responder.js b/js/ajax-responder.js
index 168e1e1..558c9b0 100644
--- a/js/ajax-responder.js
+++ b/js/ajax-responder.js
@@ -282,6 +282,10 @@ Drupal.CTools.AJAX.commands = {
redirect: function(data) {
location.href = data.url;
+ },
+
+ reload: function(data) {
+ location.reload();
}
};