diff --git a/CHANGELOG.txt b/CHANGELOG.txt index ff30c5e6900995aa2cd7a552297f4e26150d4f50..e6e92371b7766d5ea34caac42c4e028ff61d3127 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 54175504c1704bbaceefaed31f7211f085e95e24..5164f428efe8edb6a39d234d649c316d67eb95ae 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: * @@ -378,6 +380,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 168e1e150fbfe56c0e430ddf51b870e35b8e0b40..558c9b0bbf332ed1f76301a904763a3b860e4582 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(); } };